<jupyter_start><jupyter_text>FACECOLOR = 'fffdfd'FIGSIZE = (36,36)TICK_LABELSIZE = 54TICK_LENGTH = 24TICK_WIDTH = 4TITLE_FONTSIZE = 58MARKER_SIZE = 544ANNOTATE_SIZE = 34for NUM in range(50):         Double cleaned sections---------------------------------------------------        double_clean_fig = plt.figure(figsize = FIGSIZE, facecolor = FACECOLOR)    double_clean_section = double_clean_fig.add_subplot(1,1,1)    double_clean_section.set_title('Cleaned Twice Section ' + str(NUM), fontsize = TITLE_FONTSIZE)    double_clean_section.set_facecolor(FACECOLOR)    double_clean_section.scatter(*zip(*TuplePairsBySection[NUM]), s = MARKER_SIZE)    double_clean_section.scatter(CenterList[NUM].X, CenterList[NUM].Y, color = 'red', s = MARKER_SIZE)    double_clean_section.annotate(str(len(TuplePairsBySection[NUM])), (40, 10), fontsize = ANNOTATE_SIZE)    double_clean_section.tick_params(labelsize = TICK_LABELSIZE, length = TICK_LENGTH, width = TICK_WIDTH)         Section 1 circle 3 workaround        if len(PassesSecondNoiseTestBySection[2 * NUM]) > 0:         double_clean_section.scatter(*zip(*PassesSecondNoiseTestBySection[2 * NUM]), color = 'orange', s = MARKER_SIZE) Circle saved as D    else:         print('Circle ' + str(2 * NUM) + ' from Section ' + str(NUM) + ' has no values.')    double_clean_section.annotate(str(len(PassesSecondNoiseTestBySection[2 * NUM])) + '/' + str(len(PassesFirstNoiseTestBySection[2 * NUM])),                 (CenterList[NUM].iloc[0,1] + 10, CenterList[NUM].iloc[0,2]), fontsize = ANNOTATE_SIZE)         Section 1 circle 3 workaround        if len(PassesSecondNoiseTestBySection[2 * NUM + 1]) > 0:         double_clean_section.scatter(*zip(*PassesSecondNoiseTestBySection[2 * NUM + 1]), color = 'yellow', s = MARKER_SIZE)  Circle saved as E    else:         print('Circle ' + str(2 * NUM + 1) + ' from Section ' + str(NUM) + ' has no values.')    double_clean_section.annotate(str(len(PassesSecondNoiseTestBySection[2 * NUM + 1])) + '/' + str(len(PassesFirstNoiseTestBySection[2 * NUM + 1])),                  (CenterList[NUM].iloc[1,1] + 10, CenterList[NUM].iloc[1,2] + 10), fontsize = ANNOTATE_SIZE)    double_clean_section.annotate(str(len(PassesSecondNoiseTestBySection[2 * NUM]) + len(PassesSecondNoiseTestBySection[2 * NUM + 1])), (40, 10), fontsize = ANNOTATE_SIZE)    double_clean_section.scatter(CenterList[NUM].X, CenterList[NUM].Y, color = 'red', s = MARKER_SIZE)         save final figure     Uncomment following line when ready to save images        double_clean_fig.savefig('Results/Cleaned_Twice_Sections/cleaned_twice_section_' + str(NUM) + '.png', facecolor = double_clean_fig.get_facecolor())         Single cleaned sections---------------------------------------------------        single_clean_fig = plt.figure(figsize = FIGSIZE, facecolor = FACECOLOR)    single_clean_section = single_clean_fig.add_subplot(1,1,1)    single_clean_section.set_title('Cleaned Once Section ' + str(NUM), fontsize = TITLE_FONTSIZE)    single_clean_section.set_facecolor(FACECOLOR)    single_clean_section.scatter(*zip(*TuplePairsBySection[NUM]), s = MARKER_SIZE)    single_clean_section.scatter(CenterList[NUM].X, CenterList[NUM].Y, color = 'red', s = MARKER_SIZE)    single_clean_section.annotate(str(len(TuplePairsBySection[NUM])), (40, 10), fontsize = ANNOTATE_SIZE)    single_clean_section.tick_params(labelsize = TICK_LABELSIZE, length = TICK_LENGTH, width = TICK_WIDTH)         Section 1 circle 3 workaround        if len(PassesSecondNoiseTestBySection[2 * NUM]) > 0:         single_clean_section.scatter(*zip(*PassesSecondNoiseTestBySection[2 * NUM]), color = 'orange', s = MARKER_SIZE) Circle saved as D    else:         print('Circle ' + str(2 * NUM) + ' from Section ' + str(NUM) + ' has no values.')    single_clean_section.annotate(str(len(PassesSecondNoiseTestBySection[2 * NUM])) + '/' + str(len(PassesFirstNoiseTestBySection[2 * NUM])),                 (CenterList[NUM].iloc[0,1] + 10, CenterList[NUM].iloc[0,2]), fontsize = ANNOTATE_SIZE)         Section 1 circle 3 workaround        if len(PassesSecondNoiseTestBySection[2 * NUM + 1]) > 0:         single_clean_section.scatter(*zip(*PassesSecondNoiseTestBySection[2 * NUM + 1]), color = 'yellow', s = MARKER_SIZE)  Circle saved as E    else:         print('Circle ' + str(2 * NUM + 1) + ' from Section ' + str(NUM) + ' has no values.')    single_clean_section.annotate(str(len(PassesSecondNoiseTestBySection[2 * NUM + 1])) + '/' + str(len(PassesFirstNoiseTestBySection[2 * NUM + 1])),                  (CenterList[NUM].iloc[1,1] + 10, CenterList[NUM].iloc[1,2] + 10), fontsize = ANNOTATE_SIZE)    single_clean_section.annotate(str(len(PassesSecondNoiseTestBySection[2 * NUM]) + len(PassesSecondNoiseTestBySection[2 * NUM + 1])), (40, 10), fontsize = ANNOTATE_SIZE)    single_clean_section.scatter(CenterList[NUM].X, CenterList[NUM].Y, color = 'red', s = MARKER_SIZE)         save final figure     Uncomment following line when ready to save images        single_clean_fig.savefig('Results/Cleaned_Once_Sections/cleaned_once_section_' + str(NUM) + '.png', facecolor = single_clean_fig.get_facecolor())             Original Section----------------------------------------------------------        original_fig = plt.figure(figsize = FIGSIZE, facecolor = FACECOLOR)    original_section = original_fig.add_subplot(1,1,1)    original_section.set_title('Original Section ' + str(NUM), fontsize = TITLE_FONTSIZE)    original_section.set_facecolor(FACECOLOR)    original_section.scatter(*zip(*TuplePairsBySection[NUM]), s = MARKER_SIZE)    original_section.scatter(CenterList[NUM].X, CenterList[NUM].Y, color = 'red', s = MARKER_SIZE)    original_section.annotate(str(len(TuplePairsBySection[NUM])), (40, 10), fontsize = ANNOTATE_SIZE)    original_section.tick_params(labelsize = TICK_LABELSIZE, length = TICK_LENGTH, width = TICK_WIDTH)         save final figure     Uncomment following line when ready to save images        original_fig.savefig('Results/Original_Sections/original_section_' + str(NUM) + '.png', facecolor = original_fig.get_facecolor())         Incase these lines are needed     plt.xlim(0, max(x[0] for x in TuplePairsBySection[NUM]) * 1.25)    plt.ylim(0, max(y[1] for y in TuplePairsBySection[NUM]) * 1.25)<jupyter_code>print(PassesSecondNoiseTestBySection[0])
def printInfo(radius, Xcp, Ycp, secNum, pipeCount):
    #round values
    roundList = [radius, Xcp, Ycp]
    roundList = [round(i, 6) for i in roundList]
    radius = roundList[0]
    Xcp = roundList[1]
    Ycp = roundList[2]
    FCP = (Xcp, Ycp)
    givenR = CenterList[secNum].iloc[pipeCount,4]
    givenC_tuple = tuple(CenterList[secNum].iloc[pipeCount,1:3])
    print("The fitted center point is: (" + str(Xcp) + "," + str(Ycp) + ")")
    print("The as-designed center point is: (" + str(givenC_tuple[0]) + "," + str(givenC_tuple[1]) + ")")
    print("The distance between them is: " + str(round(math.dist(givenC_tuple, FCP), 7)))
    print("The fitted radius is: " + str(radius) + " and the actual radius is: " + str(givenR))
    print("The difference between them is: " + str(round(abs(givenR - radius), 7)))
from circle_fit import least_squares_circle, plot_data_circle

pipe_point = []
sec_count = 0
for n in range(50): 
    a = PassesSecondNoiseTestBySection[2 * n:2 * n + 2]
    if len(a[0]) > 0:
        xc,yc,r,CI = least_squares_circle(a[0], 8)
        plot_data_circle((list(zip(*a[0]))[0]),(list(zip(*a[0]))[1]),xc,yc,r)
        plt.title("Section " + str(sec_count) + " Pipe " + str(sec_count*2))
        plt.show()
        printInfo(r, xc, yc, sec_count, 0)
        pipe_point.append({xc, yc})
    else:
        pass
    if len(a[1]) > 0:
        xc,yc,r,CI = least_squares_circle(a[1], 4.375)
        plot_data_circle((list(zip(*a[1]))[0]),(list(zip(*a[1]))[1]),xc,yc,r)
        plt.title("Section " + str(sec_count) + " Pipe " + str(sec_count*2 + 1))
        plt.show()
        printInfo(r, xc, yc, sec_count, 1)
        pipe_point.append({xc, yc})
    else:
        pass
    sec_count += 1
print(pipe_point)
with open('eggs.csv', 'w', newline='') as csvfile:
    writer = csv.writer(csvfile, delimiter=' ')
    for i in range(len(pipe_point)):
        writer.writerow(pipe_point[i])<jupyter_output>[{65.99212977737245, 66.0750842557238}, {40.75893972847235, 34.02228378137305}, {65.83268422455134, 65.74691508026014}, {65.79047135393093, 65.6307682161197}, {9.221599842583299, 42.9605638504916}, {65.26236456307626, 65.18939280231143}, {9.595466347826376, 42.14635923696188}, {64.8180933425239, 65.04960542331038}, {40.72440901420797, 9.032391727817748}, {64.35458411826713, 65.22817662350533}, {40.23010125335363, 9.2064339687321}, {64.02134521438822, 65.6328638467182}, {9.656897689500317, 39.47845973742533}, {65.98675915290738, 63.94849641835907}, {10.073495214040227, 39.187152337857476}, {66.02635251416143, 63.49970861125669}, {10.248783219486915, 39.56106829034284}, {65.63926610905284, 63.62993131919086}, {40.26616487794417, 10.490391579606007}, {65.53738148023056, 63.5535944554081}, {10.222839348726229, 43.5507132346296}, {65.62484780913368, 63.54886868795739}, {10.337248122318012, 42.00783610466282}, {65.7930625216963, 63.62035128122828}, {9.810972571360677, 45.01781987392673}, {65[...]
{'fraction_non_alphanumeric': 0.15361216730038021, 'fraction_numerical': 0.10581205866376969, 'mean_word_length': 4.2786697247706424, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '529804', 'license': 'MIT', 'n_tokens_mistral': 3843, 'n_tokens_neox': 3227, 'n_words': 582, 'path': 'Clouded.ipynb', 'repo_name': 'AlephNaughtNWMSU/seminar', 'size': '9205'}