diff --git a/examples/applyctf.py b/examples/applyctf.py new file mode 100644 index 0000000..df76fd3 --- /dev/null +++ b/examples/applyctf.py @@ -0,0 +1,55 @@ +import sqlite3 + +db = sqlite3.connect("database.db") +cur = db.cursor() + +cur.execute("select image_assets.filename, estimated_ctf_parameters.defocus1, estimated_ctf_parameters.defocus2, estimated_ctf_parameters.defocus_angle, estimated_ctf_parameters.additional_phase_shift from image_assets where image_assets.filename like '%niceview_00182%'") +print(cur.fetchall()) + + + + +import os +from subprocess import Popen, PIPE +from collections import namedtuple + +ApplyCtfParameters = namedtuple("input",[ + "output", + "pixelsize", + "kV", + "cs", + "ac", + "file", + "defocus1", + "defocus2", + "astigmatism_angle", + "phase_shift", + "flip_only", + "contrast" + +],defaults = [ + "in.mrc", + "out.mrc", + 40.0, + 300.0, + 2.7, + 0.07, + "NO", + 100000, + 100000, + 0.0, + 0.0, + "YES", + "YES", + +]) + +para = ApplyCtfParameters(input = "in.mrc" + output="out.mrc", + defocus1 = 300000, + defocus2 = 300000, + astigmatism_angle=0.0) + +if True: + proc = Popen("applyctf", shell=True, stdin=PIPE) + proc.communicate(input=str.encode('\n'.join(map(str,list(para))))) \ No newline at end of file diff --git a/examples/cistem_processing.ipynb b/examples/cistem_processing.ipynb index 4c0acdf..8f3ede8 100644 --- a/examples/cistem_processing.ipynb +++ b/examples/cistem_processing.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -13,459 +13,51 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Attempting to create a new database, but the file already existsFrom ../../../src/core/database.cpp:489\n", - "bool Database::CreateNewDatabase(wxFileName)\n" - ] - } - ], + "outputs": [], "source": [ "database = create_project(\"Test20230706\",\"/nrs/elferich\")" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "10" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "import_movies(database, \"/data/elferich/pycistem_test\", pixelsize=0.53, exposure_dose=0.8 )" ] }, { "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
MOVIE_ASSET_IDNAMEFILENAMEPOSITION_IN_STACKX_SIZEY_SIZENUMBER_OF_FRAMESVOLTAGEPIXEL_SIZEDOSE_PER_FRAME...GAIN_FILENAMEDARK_FILENAMEOUTPUT_BINNING_FACTORCORRECT_MAG_DISTORTIONMAG_DISTORTION_ANGLEMAG_DISTORTION_MAJOR_SCALEMAG_DISTORTION_MINOR_SCALEPROTEIN_IS_WHITEEER_SUPER_RES_FACTOREER_FRAMES_PER_IMAGE
01s_records_15-10_00000_-20.0_Oct29_18.43.38.tif/data/elferich/pycistem_test/s_records_15-10_0...011520818434300.00.530.8.../data/elferich/pycistem_test/SuperCDSRef_s_lam...1.88679200.01.01.00251
12s_records_15-11_00000_-20.0_Oct29_18.44.48.tif/data/elferich/pycistem_test/s_records_15-11_0...011520818434300.00.530.8.../data/elferich/pycistem_test/SuperCDSRef_s_lam...1.88679200.01.01.00251
23s_records_15-12_00000_-20.0_Oct29_18.45.52.tif/data/elferich/pycistem_test/s_records_15-12_0...011520818434300.00.530.8.../data/elferich/pycistem_test/SuperCDSRef_s_lam...1.88679200.01.01.00251
34s_records_15-13_00000_-20.0_Oct29_18.47.03.tif/data/elferich/pycistem_test/s_records_15-13_0...011520818434300.00.530.8.../data/elferich/pycistem_test/SuperCDSRef_s_lam...1.88679200.01.01.00251
45s_records_15-14_00000_-20.0_Oct29_18.48.18.tif/data/elferich/pycistem_test/s_records_15-14_0...011520818434300.00.530.8.../data/elferich/pycistem_test/SuperCDSRef_s_lam...1.88679200.01.01.00251
56s_records_15-15_00000_-20.0_Oct29_18.49.17.tif/data/elferich/pycistem_test/s_records_15-15_0...011520818434300.00.530.8.../data/elferich/pycistem_test/SuperCDSRef_s_lam...1.88679200.01.01.00251
67s_records_15-16_00000_-20.0_Oct29_18.51.21.tif/data/elferich/pycistem_test/s_records_15-16_0...011520818434300.00.530.8.../data/elferich/pycistem_test/SuperCDSRef_s_lam...1.88679200.01.01.00251
78s_records_15-17_00000_-20.0_Oct29_18.52.26.tif/data/elferich/pycistem_test/s_records_15-17_0...011520818434300.00.530.8.../data/elferich/pycistem_test/SuperCDSRef_s_lam...1.88679200.01.01.00251
89s_records_15-18_00000_-20.0_Oct29_18.53.25.tif/data/elferich/pycistem_test/s_records_15-18_0...011520818434300.00.530.8.../data/elferich/pycistem_test/SuperCDSRef_s_lam...1.88679200.01.01.00251
910s_records_15-19_00000_-20.0_Oct29_18.54.29.tif/data/elferich/pycistem_test/s_records_15-19_0...011520818434300.00.530.8.../data/elferich/pycistem_test/SuperCDSRef_s_lam...1.88679200.01.01.00251
\n", - "

10 rows × 21 columns

\n", - "
" - ], - "text/plain": [ - " MOVIE_ASSET_ID NAME \n", - "0 1 s_records_15-10_00000_-20.0_Oct29_18.43.38.tif \\\n", - "1 2 s_records_15-11_00000_-20.0_Oct29_18.44.48.tif \n", - "2 3 s_records_15-12_00000_-20.0_Oct29_18.45.52.tif \n", - "3 4 s_records_15-13_00000_-20.0_Oct29_18.47.03.tif \n", - "4 5 s_records_15-14_00000_-20.0_Oct29_18.48.18.tif \n", - "5 6 s_records_15-15_00000_-20.0_Oct29_18.49.17.tif \n", - "6 7 s_records_15-16_00000_-20.0_Oct29_18.51.21.tif \n", - "7 8 s_records_15-17_00000_-20.0_Oct29_18.52.26.tif \n", - "8 9 s_records_15-18_00000_-20.0_Oct29_18.53.25.tif \n", - "9 10 s_records_15-19_00000_-20.0_Oct29_18.54.29.tif \n", - "\n", - " FILENAME POSITION_IN_STACK \n", - "0 /data/elferich/pycistem_test/s_records_15-10_0... 0 \\\n", - "1 /data/elferich/pycistem_test/s_records_15-11_0... 0 \n", - "2 /data/elferich/pycistem_test/s_records_15-12_0... 0 \n", - "3 /data/elferich/pycistem_test/s_records_15-13_0... 0 \n", - "4 /data/elferich/pycistem_test/s_records_15-14_0... 0 \n", - "5 /data/elferich/pycistem_test/s_records_15-15_0... 0 \n", - "6 /data/elferich/pycistem_test/s_records_15-16_0... 0 \n", - "7 /data/elferich/pycistem_test/s_records_15-17_0... 0 \n", - "8 /data/elferich/pycistem_test/s_records_15-18_0... 0 \n", - "9 /data/elferich/pycistem_test/s_records_15-19_0... 0 \n", - "\n", - " X_SIZE Y_SIZE NUMBER_OF_FRAMES VOLTAGE PIXEL_SIZE DOSE_PER_FRAME ... \n", - "0 11520 8184 34 300.0 0.53 0.8 ... \\\n", - "1 11520 8184 34 300.0 0.53 0.8 ... \n", - "2 11520 8184 34 300.0 0.53 0.8 ... \n", - "3 11520 8184 34 300.0 0.53 0.8 ... \n", - "4 11520 8184 34 300.0 0.53 0.8 ... \n", - "5 11520 8184 34 300.0 0.53 0.8 ... \n", - "6 11520 8184 34 300.0 0.53 0.8 ... \n", - "7 11520 8184 34 300.0 0.53 0.8 ... \n", - "8 11520 8184 34 300.0 0.53 0.8 ... \n", - "9 11520 8184 34 300.0 0.53 0.8 ... \n", - "\n", - " GAIN_FILENAME DARK_FILENAME \n", - "0 /data/elferich/pycistem_test/SuperCDSRef_s_lam... \\\n", - "1 /data/elferich/pycistem_test/SuperCDSRef_s_lam... \n", - "2 /data/elferich/pycistem_test/SuperCDSRef_s_lam... \n", - "3 /data/elferich/pycistem_test/SuperCDSRef_s_lam... \n", - "4 /data/elferich/pycistem_test/SuperCDSRef_s_lam... \n", - "5 /data/elferich/pycistem_test/SuperCDSRef_s_lam... \n", - "6 /data/elferich/pycistem_test/SuperCDSRef_s_lam... \n", - "7 /data/elferich/pycistem_test/SuperCDSRef_s_lam... \n", - "8 /data/elferich/pycistem_test/SuperCDSRef_s_lam... \n", - "9 /data/elferich/pycistem_test/SuperCDSRef_s_lam... \n", - "\n", - " OUTPUT_BINNING_FACTOR CORRECT_MAG_DISTORTION MAG_DISTORTION_ANGLE \n", - "0 1.886792 0 0.0 \\\n", - "1 1.886792 0 0.0 \n", - "2 1.886792 0 0.0 \n", - "3 1.886792 0 0.0 \n", - "4 1.886792 0 0.0 \n", - "5 1.886792 0 0.0 \n", - "6 1.886792 0 0.0 \n", - "7 1.886792 0 0.0 \n", - "8 1.886792 0 0.0 \n", - "9 1.886792 0 0.0 \n", - "\n", - " MAG_DISTORTION_MAJOR_SCALE MAG_DISTORTION_MINOR_SCALE PROTEIN_IS_WHITE \n", - "0 1.0 1.0 0 \\\n", - "1 1.0 1.0 0 \n", - "2 1.0 1.0 0 \n", - "3 1.0 1.0 0 \n", - "4 1.0 1.0 0 \n", - "5 1.0 1.0 0 \n", - "6 1.0 1.0 0 \n", - "7 1.0 1.0 0 \n", - "8 1.0 1.0 0 \n", - "9 1.0 1.0 0 \n", - "\n", - " EER_SUPER_RES_FACTOR EER_FRAMES_PER_IMAGE \n", - "0 25 1 \n", - "1 25 1 \n", - "2 25 1 \n", - "3 25 1 \n", - "4 25 1 \n", - "5 25 1 \n", - "6 25 1 \n", - "7 25 1 \n", - "8 25 1 \n", - "9 25 1 \n", - "\n", - "[10 rows x 21 columns]" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "get_movie_info_from_db(database)" - ] - }, - { - "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "from pycistem.programs import unblur" + "get_movie_info_from_db(database)" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "import pycistem.config" + "from pycistem.programs import unblur\n", + "import pycistem.config\n", + "pycistem.config.set_cistem_path(\"/groups/cryoadmin/software/CISTEM/je_dev/\")\n", + "from rich import print" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "pycistem.config.set_cistem_path(\"/scratch/paris/elferich/cisTEM/build/je_combined_Intel-gpu-debug-static/src/\")" + "pars = unblur.parameters_from_database(database)\n", + "print(pars)" ] }, { @@ -474,1778 +66,105 @@ "metadata": {}, "outputs": [], "source": [ - "pycistem.config.set_cistem_path(\"\")" + "results = await unblur.run_async(pars,num_procs=12)" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "par = unblur.UnblurParameters(\n", - " input_filename=\"/data/elferich/CryoTEM/Johannes_20230317/THP1_24hbr_g1/lamella1/frames/s_THP1_24hbr_g1_niceview_00182_20.0_Mar18_08.41.58.tif\",\n", - " gain_filename=\"/data/elferich/pycistem_test/SuperCDSRef_s_lamella_00000_-20.0_Oct29_12.16.03.dm4\",\n", - " output_filename=\"/tmp/unblurred.mrc\",\n", - " pixel_size=0.53,\n", - " output_binning_factor= 3.774,\n", - " exposure_per_frame=0.8)" + "print(results)" ] }, { "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[{'parameter_index': 0,\n", - " 'x_shifts': [-0.8355296850204468,\n", - " -0.6767469048500061,\n", - " -0.517964243888855,\n", - " -0.31791678071022034,\n", - " -0.14262375235557556,\n", - " -0.04814090579748154,\n", - " 0.0007318812422454357,\n", - " 0.027680905535817146,\n", - " 0.07455175369977951,\n", - " 0.06613209843635559,\n", - " 0.03766568377614021,\n", - " 0.007191785145550966,\n", - " 0.0010283474111929536,\n", - " -0.004403194412589073,\n", - " 0.008133470080792904,\n", - " 0.0036570087540894747,\n", - " 0.0,\n", - " 0.030016234144568443,\n", - " 0.041119206696748734,\n", - " 0.08709361404180527,\n", - " 0.12286786735057831,\n", - " 0.12801174819469452,\n", - " 0.1457388997077942,\n", - " 0.15635783970355988,\n", - " 0.14271584153175354,\n", - " 0.12017127126455307,\n", - " 0.0724998489022255,\n", - " 0.06943974643945694,\n", - " 0.0764937624335289,\n", - " 0.07781965285539627,\n", - " 0.14851540327072144],\n", - " 'y_shifts': [0.17465399205684662,\n", - " 0.2007925808429718,\n", - " -5.631543159484863,\n", - " -5.098708629608154,\n", - " -4.5658745765686035,\n", - " -3.9704959392547607,\n", - " -3.449512243270874,\n", - " -2.9885270595550537,\n", - " -2.580538511276245,\n", - " -2.184069871902466,\n", - " -1.833959698677063,\n", - " -1.5394212007522583,\n", - " -1.2540496587753296,\n", - " -1.0063328742980957,\n", - " -0.7762328386306763,\n", - " -0.5742053985595703,\n", - " -0.37801873683929443,\n", - " -0.19557835161685944,\n", - " 0.0,\n", - " 0.21706800162792206,\n", - " 0.43769609928131104,\n", - " 0.647528886795044,\n", - " 0.8447352647781372,\n", - " 1.016554594039917,\n", - " 1.2002308368682861,\n", - " 1.3691208362579346,\n", - " 1.4954516887664795,\n", - " 1.6116656064987183,\n", - " 1.7285096645355225,\n", - " 1.853015661239624,\n", - " 1.9920814037322998],\n", - " 'orig_x': 2,\n", - " 'orig_y': 2,\n", - " 'crop_x': 2,\n", - " 'crop_y': 2}]" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "await unblur.run_async(par) " - ] - }, - { - "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "[UnblurParameters(input_filename='/data/elferich/pycistem_test/s_records_15-10_00000_-20.0_Oct29_18.43.38.tif', output_filename='/nrs/elferich/Test20230706/Assets/Images/s_records_15-10_00000_-20.0_Oct29_18.43.38_1_auto_0.mrc', pixel_size=0.53, minimum_shift_in_angstroms=2.0, maximum_shift_in_angstroms=40.0, should_dose_filter=True, should_restore_power=True, termination_threshold_in_angstroms=1.0, max_iterations=10, bfactor_in_angstroms=1500, should_mask_central_cross=True, horizontal_mask_size=1, vertical_mask_size=1, acceleration_voltage=300.0, exposure_per_frame=0.8, pre_exposure_amount=0.0, movie_is_gain_corrected=False, gain_filename='/data/elferich/pycistem_test/SuperCDSRef_s_lamella_00000_-20.0_Oct29_12.16.03.dm4', movie_is_dark_corrected=True, dark_filename='dark.mrc', output_binning_factor=1.8867924528301885, correct_mag_distortion=False, mag_distortion_angle=0.0, mag_distortion_major_scale=1.0, mag_distortion_minor_scale=1.0, write_out_amplitude_spectrum=True, amplitude_spectrum_filename='/nrs/elferich/Test20230706/Assets/Images/Spectra/s_records_15-10_00000_-20.0_Oct29_18.43.38_1_auto.mrc', write_out_small_sum_image=True, small_sum_image_filename='/nrs/elferich/Test20230706/Assets/Images/Scaled/s_records_15-10_00000_-20.0_Oct29_18.43.38_1_auto.mrc', first_frame=1, last_frame=0, number_of_frames_for_running_average=1, max_threads=1, save_aligned_frames=False, aligned_frames_filename='aligned_frames.mrc', output_shift_text_file='shifts.txt', eer_frames_per_image=0, eer_super_res_factor=1, align_on_cropped_area=False, cropped_area_center_x=0, cropped_area_center_y=0, cropped_area_size_x=-1, cropped_area_size_y=-1, replace_dark_areas_with_gaussian_noise=False, threshold_for_gaussian_noise=0.1, measure_mean_and_variance_for_gaussian_noise=False, mean_for_gaussian_noise=0.0, variance_for_gaussian_noise=0.0),\n", - " UnblurParameters(input_filename='/data/elferich/pycistem_test/s_records_15-11_00000_-20.0_Oct29_18.44.48.tif', output_filename='/nrs/elferich/Test20230706/Assets/Images/s_records_15-11_00000_-20.0_Oct29_18.44.48_2_auto_1.mrc', pixel_size=0.53, minimum_shift_in_angstroms=2.0, maximum_shift_in_angstroms=40.0, should_dose_filter=True, should_restore_power=True, termination_threshold_in_angstroms=1.0, max_iterations=10, bfactor_in_angstroms=1500, should_mask_central_cross=True, horizontal_mask_size=1, vertical_mask_size=1, acceleration_voltage=300.0, exposure_per_frame=0.8, pre_exposure_amount=0.0, movie_is_gain_corrected=False, gain_filename='/data/elferich/pycistem_test/SuperCDSRef_s_lamella_00000_-20.0_Oct29_12.16.03.dm4', movie_is_dark_corrected=True, dark_filename='dark.mrc', output_binning_factor=1.8867924528301885, correct_mag_distortion=False, mag_distortion_angle=0.0, mag_distortion_major_scale=1.0, mag_distortion_minor_scale=1.0, write_out_amplitude_spectrum=True, amplitude_spectrum_filename='/nrs/elferich/Test20230706/Assets/Images/Spectra/s_records_15-11_00000_-20.0_Oct29_18.44.48_2_auto.mrc', write_out_small_sum_image=True, small_sum_image_filename='/nrs/elferich/Test20230706/Assets/Images/Scaled/s_records_15-11_00000_-20.0_Oct29_18.44.48_2_auto.mrc', first_frame=1, last_frame=0, number_of_frames_for_running_average=1, max_threads=1, save_aligned_frames=False, aligned_frames_filename='aligned_frames.mrc', output_shift_text_file='shifts.txt', eer_frames_per_image=0, eer_super_res_factor=1, align_on_cropped_area=False, cropped_area_center_x=0, cropped_area_center_y=0, cropped_area_size_x=-1, cropped_area_size_y=-1, replace_dark_areas_with_gaussian_noise=False, threshold_for_gaussian_noise=0.1, measure_mean_and_variance_for_gaussian_noise=False, mean_for_gaussian_noise=0.0, variance_for_gaussian_noise=0.0),\n", - " UnblurParameters(input_filename='/data/elferich/pycistem_test/s_records_15-12_00000_-20.0_Oct29_18.45.52.tif', output_filename='/nrs/elferich/Test20230706/Assets/Images/s_records_15-12_00000_-20.0_Oct29_18.45.52_3_auto_2.mrc', pixel_size=0.53, minimum_shift_in_angstroms=2.0, maximum_shift_in_angstroms=40.0, should_dose_filter=True, should_restore_power=True, termination_threshold_in_angstroms=1.0, max_iterations=10, bfactor_in_angstroms=1500, should_mask_central_cross=True, horizontal_mask_size=1, vertical_mask_size=1, acceleration_voltage=300.0, exposure_per_frame=0.8, pre_exposure_amount=0.0, movie_is_gain_corrected=False, gain_filename='/data/elferich/pycistem_test/SuperCDSRef_s_lamella_00000_-20.0_Oct29_12.16.03.dm4', movie_is_dark_corrected=True, dark_filename='dark.mrc', output_binning_factor=1.8867924528301885, correct_mag_distortion=False, mag_distortion_angle=0.0, mag_distortion_major_scale=1.0, mag_distortion_minor_scale=1.0, write_out_amplitude_spectrum=True, amplitude_spectrum_filename='/nrs/elferich/Test20230706/Assets/Images/Spectra/s_records_15-12_00000_-20.0_Oct29_18.45.52_3_auto.mrc', write_out_small_sum_image=True, small_sum_image_filename='/nrs/elferich/Test20230706/Assets/Images/Scaled/s_records_15-12_00000_-20.0_Oct29_18.45.52_3_auto.mrc', first_frame=1, last_frame=0, number_of_frames_for_running_average=1, max_threads=1, save_aligned_frames=False, aligned_frames_filename='aligned_frames.mrc', output_shift_text_file='shifts.txt', eer_frames_per_image=0, eer_super_res_factor=1, align_on_cropped_area=False, cropped_area_center_x=0, cropped_area_center_y=0, cropped_area_size_x=-1, cropped_area_size_y=-1, replace_dark_areas_with_gaussian_noise=False, threshold_for_gaussian_noise=0.1, measure_mean_and_variance_for_gaussian_noise=False, mean_for_gaussian_noise=0.0, variance_for_gaussian_noise=0.0),\n", - " UnblurParameters(input_filename='/data/elferich/pycistem_test/s_records_15-13_00000_-20.0_Oct29_18.47.03.tif', output_filename='/nrs/elferich/Test20230706/Assets/Images/s_records_15-13_00000_-20.0_Oct29_18.47.03_4_auto_3.mrc', pixel_size=0.53, minimum_shift_in_angstroms=2.0, maximum_shift_in_angstroms=40.0, should_dose_filter=True, should_restore_power=True, termination_threshold_in_angstroms=1.0, max_iterations=10, bfactor_in_angstroms=1500, should_mask_central_cross=True, horizontal_mask_size=1, vertical_mask_size=1, acceleration_voltage=300.0, exposure_per_frame=0.8, pre_exposure_amount=0.0, movie_is_gain_corrected=False, gain_filename='/data/elferich/pycistem_test/SuperCDSRef_s_lamella_00000_-20.0_Oct29_12.16.03.dm4', movie_is_dark_corrected=True, dark_filename='dark.mrc', output_binning_factor=1.8867924528301885, correct_mag_distortion=False, mag_distortion_angle=0.0, mag_distortion_major_scale=1.0, mag_distortion_minor_scale=1.0, write_out_amplitude_spectrum=True, amplitude_spectrum_filename='/nrs/elferich/Test20230706/Assets/Images/Spectra/s_records_15-13_00000_-20.0_Oct29_18.47.03_4_auto.mrc', write_out_small_sum_image=True, small_sum_image_filename='/nrs/elferich/Test20230706/Assets/Images/Scaled/s_records_15-13_00000_-20.0_Oct29_18.47.03_4_auto.mrc', first_frame=1, last_frame=0, number_of_frames_for_running_average=1, max_threads=1, save_aligned_frames=False, aligned_frames_filename='aligned_frames.mrc', output_shift_text_file='shifts.txt', eer_frames_per_image=0, eer_super_res_factor=1, align_on_cropped_area=False, cropped_area_center_x=0, cropped_area_center_y=0, cropped_area_size_x=-1, cropped_area_size_y=-1, replace_dark_areas_with_gaussian_noise=False, threshold_for_gaussian_noise=0.1, measure_mean_and_variance_for_gaussian_noise=False, mean_for_gaussian_noise=0.0, variance_for_gaussian_noise=0.0),\n", - " UnblurParameters(input_filename='/data/elferich/pycistem_test/s_records_15-14_00000_-20.0_Oct29_18.48.18.tif', output_filename='/nrs/elferich/Test20230706/Assets/Images/s_records_15-14_00000_-20.0_Oct29_18.48.18_5_auto_4.mrc', pixel_size=0.53, minimum_shift_in_angstroms=2.0, maximum_shift_in_angstroms=40.0, should_dose_filter=True, should_restore_power=True, termination_threshold_in_angstroms=1.0, max_iterations=10, bfactor_in_angstroms=1500, should_mask_central_cross=True, horizontal_mask_size=1, vertical_mask_size=1, acceleration_voltage=300.0, exposure_per_frame=0.8, pre_exposure_amount=0.0, movie_is_gain_corrected=False, gain_filename='/data/elferich/pycistem_test/SuperCDSRef_s_lamella_00000_-20.0_Oct29_12.16.03.dm4', movie_is_dark_corrected=True, dark_filename='dark.mrc', output_binning_factor=1.8867924528301885, correct_mag_distortion=False, mag_distortion_angle=0.0, mag_distortion_major_scale=1.0, mag_distortion_minor_scale=1.0, write_out_amplitude_spectrum=True, amplitude_spectrum_filename='/nrs/elferich/Test20230706/Assets/Images/Spectra/s_records_15-14_00000_-20.0_Oct29_18.48.18_5_auto.mrc', write_out_small_sum_image=True, small_sum_image_filename='/nrs/elferich/Test20230706/Assets/Images/Scaled/s_records_15-14_00000_-20.0_Oct29_18.48.18_5_auto.mrc', first_frame=1, last_frame=0, number_of_frames_for_running_average=1, max_threads=1, save_aligned_frames=False, aligned_frames_filename='aligned_frames.mrc', output_shift_text_file='shifts.txt', eer_frames_per_image=0, eer_super_res_factor=1, align_on_cropped_area=False, cropped_area_center_x=0, cropped_area_center_y=0, cropped_area_size_x=-1, cropped_area_size_y=-1, replace_dark_areas_with_gaussian_noise=False, threshold_for_gaussian_noise=0.1, measure_mean_and_variance_for_gaussian_noise=False, mean_for_gaussian_noise=0.0, variance_for_gaussian_noise=0.0),\n", - " UnblurParameters(input_filename='/data/elferich/pycistem_test/s_records_15-15_00000_-20.0_Oct29_18.49.17.tif', output_filename='/nrs/elferich/Test20230706/Assets/Images/s_records_15-15_00000_-20.0_Oct29_18.49.17_6_auto_5.mrc', pixel_size=0.53, minimum_shift_in_angstroms=2.0, maximum_shift_in_angstroms=40.0, should_dose_filter=True, should_restore_power=True, termination_threshold_in_angstroms=1.0, max_iterations=10, bfactor_in_angstroms=1500, should_mask_central_cross=True, horizontal_mask_size=1, vertical_mask_size=1, acceleration_voltage=300.0, exposure_per_frame=0.8, pre_exposure_amount=0.0, movie_is_gain_corrected=False, gain_filename='/data/elferich/pycistem_test/SuperCDSRef_s_lamella_00000_-20.0_Oct29_12.16.03.dm4', movie_is_dark_corrected=True, dark_filename='dark.mrc', output_binning_factor=1.8867924528301885, correct_mag_distortion=False, mag_distortion_angle=0.0, mag_distortion_major_scale=1.0, mag_distortion_minor_scale=1.0, write_out_amplitude_spectrum=True, amplitude_spectrum_filename='/nrs/elferich/Test20230706/Assets/Images/Spectra/s_records_15-15_00000_-20.0_Oct29_18.49.17_6_auto.mrc', write_out_small_sum_image=True, small_sum_image_filename='/nrs/elferich/Test20230706/Assets/Images/Scaled/s_records_15-15_00000_-20.0_Oct29_18.49.17_6_auto.mrc', first_frame=1, last_frame=0, number_of_frames_for_running_average=1, max_threads=1, save_aligned_frames=False, aligned_frames_filename='aligned_frames.mrc', output_shift_text_file='shifts.txt', eer_frames_per_image=0, eer_super_res_factor=1, align_on_cropped_area=False, cropped_area_center_x=0, cropped_area_center_y=0, cropped_area_size_x=-1, cropped_area_size_y=-1, replace_dark_areas_with_gaussian_noise=False, threshold_for_gaussian_noise=0.1, measure_mean_and_variance_for_gaussian_noise=False, mean_for_gaussian_noise=0.0, variance_for_gaussian_noise=0.0),\n", - " UnblurParameters(input_filename='/data/elferich/pycistem_test/s_records_15-16_00000_-20.0_Oct29_18.51.21.tif', output_filename='/nrs/elferich/Test20230706/Assets/Images/s_records_15-16_00000_-20.0_Oct29_18.51.21_7_auto_6.mrc', pixel_size=0.53, minimum_shift_in_angstroms=2.0, maximum_shift_in_angstroms=40.0, should_dose_filter=True, should_restore_power=True, termination_threshold_in_angstroms=1.0, max_iterations=10, bfactor_in_angstroms=1500, should_mask_central_cross=True, horizontal_mask_size=1, vertical_mask_size=1, acceleration_voltage=300.0, exposure_per_frame=0.8, pre_exposure_amount=0.0, movie_is_gain_corrected=False, gain_filename='/data/elferich/pycistem_test/SuperCDSRef_s_lamella_00000_-20.0_Oct29_12.16.03.dm4', movie_is_dark_corrected=True, dark_filename='dark.mrc', output_binning_factor=1.8867924528301885, correct_mag_distortion=False, mag_distortion_angle=0.0, mag_distortion_major_scale=1.0, mag_distortion_minor_scale=1.0, write_out_amplitude_spectrum=True, amplitude_spectrum_filename='/nrs/elferich/Test20230706/Assets/Images/Spectra/s_records_15-16_00000_-20.0_Oct29_18.51.21_7_auto.mrc', write_out_small_sum_image=True, small_sum_image_filename='/nrs/elferich/Test20230706/Assets/Images/Scaled/s_records_15-16_00000_-20.0_Oct29_18.51.21_7_auto.mrc', first_frame=1, last_frame=0, number_of_frames_for_running_average=1, max_threads=1, save_aligned_frames=False, aligned_frames_filename='aligned_frames.mrc', output_shift_text_file='shifts.txt', eer_frames_per_image=0, eer_super_res_factor=1, align_on_cropped_area=False, cropped_area_center_x=0, cropped_area_center_y=0, cropped_area_size_x=-1, cropped_area_size_y=-1, replace_dark_areas_with_gaussian_noise=False, threshold_for_gaussian_noise=0.1, measure_mean_and_variance_for_gaussian_noise=False, mean_for_gaussian_noise=0.0, variance_for_gaussian_noise=0.0),\n", - " UnblurParameters(input_filename='/data/elferich/pycistem_test/s_records_15-17_00000_-20.0_Oct29_18.52.26.tif', output_filename='/nrs/elferich/Test20230706/Assets/Images/s_records_15-17_00000_-20.0_Oct29_18.52.26_8_auto_7.mrc', pixel_size=0.53, minimum_shift_in_angstroms=2.0, maximum_shift_in_angstroms=40.0, should_dose_filter=True, should_restore_power=True, termination_threshold_in_angstroms=1.0, max_iterations=10, bfactor_in_angstroms=1500, should_mask_central_cross=True, horizontal_mask_size=1, vertical_mask_size=1, acceleration_voltage=300.0, exposure_per_frame=0.8, pre_exposure_amount=0.0, movie_is_gain_corrected=False, gain_filename='/data/elferich/pycistem_test/SuperCDSRef_s_lamella_00000_-20.0_Oct29_12.16.03.dm4', movie_is_dark_corrected=True, dark_filename='dark.mrc', output_binning_factor=1.8867924528301885, correct_mag_distortion=False, mag_distortion_angle=0.0, mag_distortion_major_scale=1.0, mag_distortion_minor_scale=1.0, write_out_amplitude_spectrum=True, amplitude_spectrum_filename='/nrs/elferich/Test20230706/Assets/Images/Spectra/s_records_15-17_00000_-20.0_Oct29_18.52.26_8_auto.mrc', write_out_small_sum_image=True, small_sum_image_filename='/nrs/elferich/Test20230706/Assets/Images/Scaled/s_records_15-17_00000_-20.0_Oct29_18.52.26_8_auto.mrc', first_frame=1, last_frame=0, number_of_frames_for_running_average=1, max_threads=1, save_aligned_frames=False, aligned_frames_filename='aligned_frames.mrc', output_shift_text_file='shifts.txt', eer_frames_per_image=0, eer_super_res_factor=1, align_on_cropped_area=False, cropped_area_center_x=0, cropped_area_center_y=0, cropped_area_size_x=-1, cropped_area_size_y=-1, replace_dark_areas_with_gaussian_noise=False, threshold_for_gaussian_noise=0.1, measure_mean_and_variance_for_gaussian_noise=False, mean_for_gaussian_noise=0.0, variance_for_gaussian_noise=0.0),\n", - " UnblurParameters(input_filename='/data/elferich/pycistem_test/s_records_15-18_00000_-20.0_Oct29_18.53.25.tif', output_filename='/nrs/elferich/Test20230706/Assets/Images/s_records_15-18_00000_-20.0_Oct29_18.53.25_9_auto_8.mrc', pixel_size=0.53, minimum_shift_in_angstroms=2.0, maximum_shift_in_angstroms=40.0, should_dose_filter=True, should_restore_power=True, termination_threshold_in_angstroms=1.0, max_iterations=10, bfactor_in_angstroms=1500, should_mask_central_cross=True, horizontal_mask_size=1, vertical_mask_size=1, acceleration_voltage=300.0, exposure_per_frame=0.8, pre_exposure_amount=0.0, movie_is_gain_corrected=False, gain_filename='/data/elferich/pycistem_test/SuperCDSRef_s_lamella_00000_-20.0_Oct29_12.16.03.dm4', movie_is_dark_corrected=True, dark_filename='dark.mrc', output_binning_factor=1.8867924528301885, correct_mag_distortion=False, mag_distortion_angle=0.0, mag_distortion_major_scale=1.0, mag_distortion_minor_scale=1.0, write_out_amplitude_spectrum=True, amplitude_spectrum_filename='/nrs/elferich/Test20230706/Assets/Images/Spectra/s_records_15-18_00000_-20.0_Oct29_18.53.25_9_auto.mrc', write_out_small_sum_image=True, small_sum_image_filename='/nrs/elferich/Test20230706/Assets/Images/Scaled/s_records_15-18_00000_-20.0_Oct29_18.53.25_9_auto.mrc', first_frame=1, last_frame=0, number_of_frames_for_running_average=1, max_threads=1, save_aligned_frames=False, aligned_frames_filename='aligned_frames.mrc', output_shift_text_file='shifts.txt', eer_frames_per_image=0, eer_super_res_factor=1, align_on_cropped_area=False, cropped_area_center_x=0, cropped_area_center_y=0, cropped_area_size_x=-1, cropped_area_size_y=-1, replace_dark_areas_with_gaussian_noise=False, threshold_for_gaussian_noise=0.1, measure_mean_and_variance_for_gaussian_noise=False, mean_for_gaussian_noise=0.0, variance_for_gaussian_noise=0.0),\n", - " UnblurParameters(input_filename='/data/elferich/pycistem_test/s_records_15-19_00000_-20.0_Oct29_18.54.29.tif', output_filename='/nrs/elferich/Test20230706/Assets/Images/s_records_15-19_00000_-20.0_Oct29_18.54.29_10_auto_9.mrc', pixel_size=0.53, minimum_shift_in_angstroms=2.0, maximum_shift_in_angstroms=40.0, should_dose_filter=True, should_restore_power=True, termination_threshold_in_angstroms=1.0, max_iterations=10, bfactor_in_angstroms=1500, should_mask_central_cross=True, horizontal_mask_size=1, vertical_mask_size=1, acceleration_voltage=300.0, exposure_per_frame=0.8, pre_exposure_amount=0.0, movie_is_gain_corrected=False, gain_filename='/data/elferich/pycistem_test/SuperCDSRef_s_lamella_00000_-20.0_Oct29_12.16.03.dm4', movie_is_dark_corrected=True, dark_filename='dark.mrc', output_binning_factor=1.8867924528301885, correct_mag_distortion=False, mag_distortion_angle=0.0, mag_distortion_major_scale=1.0, mag_distortion_minor_scale=1.0, write_out_amplitude_spectrum=True, amplitude_spectrum_filename='/nrs/elferich/Test20230706/Assets/Images/Spectra/s_records_15-19_00000_-20.0_Oct29_18.54.29_10_auto.mrc', write_out_small_sum_image=True, small_sum_image_filename='/nrs/elferich/Test20230706/Assets/Images/Scaled/s_records_15-19_00000_-20.0_Oct29_18.54.29_10_auto.mrc', first_frame=1, last_frame=0, number_of_frames_for_running_average=1, max_threads=1, save_aligned_frames=False, aligned_frames_filename='aligned_frames.mrc', output_shift_text_file='shifts.txt', eer_frames_per_image=0, eer_super_res_factor=1, align_on_cropped_area=False, cropped_area_center_x=0, cropped_area_center_y=0, cropped_area_size_x=-1, cropped_area_size_y=-1, replace_dark_areas_with_gaussian_noise=False, threshold_for_gaussian_noise=0.1, measure_mean_and_variance_for_gaussian_noise=False, mean_for_gaussian_noise=0.0, variance_for_gaussian_noise=0.0)]" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR:pycistem.programs.cistem_program:('127.0.0.1', 46270) did not request next job, instead sent b'GET /metrics HTT'\n" + ] } ], "source": [ - "pars = unblur.parameters_from_database(database)\n", - "pars" + "from matplotlib import pyplot as plt\n", + "plt.plot(results[0]['x_shifts'],results[0]['y_shifts'])" ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "results = await unblur.run_async(pars,num_procs=12)" + "unblur.write_results_to_database(database,pars,results)" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[{'parameter_index': 1,\n", - " 'x_shifts': [-7.260634422302246,\n", - " -6.197900295257568,\n", - " -5.135166645050049,\n", - " -3.9911038875579834,\n", - " -2.863231897354126,\n", - " -1.9996994733810425,\n", - " -1.2669581174850464,\n", - " -0.5185180306434631,\n", - " 0.2063377946615219,\n", - " 0.8101882338523865,\n", - " 1.2133642435073853,\n", - " 1.634273648262024,\n", - " 2.105318546295166,\n", - " 2.486518383026123,\n", - " 2.688049793243408,\n", - " 2.5944771766662598,\n", - " 2.4202375411987305,\n", - " 2.190764904022217,\n", - " 1.8041019439697266,\n", - " 1.332622766494751,\n", - " 0.927849292755127,\n", - " 0.5764390230178833,\n", - " 0.38682112097740173,\n", - " 0.179454043507576,\n", - " 0.19473256170749664,\n", - " 0.2636832594871521,\n", - " 0.23763281106948853,\n", - " 0.12053978443145752,\n", - " 0.053093042224645615,\n", - " 0.07594111561775208,\n", - " 0.1643475443124771,\n", - " -0.0075067742727696896,\n", - " -0.12545573711395264,\n", - " -0.028768736869096756,\n", - " 0.09265995770692825,\n", - " 0.0950642004609108,\n", - " 0.0189213827252388,\n", - " 0.0,\n", - " 0.08230602741241455,\n", - " 0.06823339313268661,\n", - " -0.0728074461221695,\n", - " -0.15401668846607208,\n", - " -0.1659349948167801,\n", - " -0.18835227191448212,\n", - " -0.29653871059417725,\n", - " -0.3780275285243988,\n", - " -0.40233954787254333,\n", - " -0.42795008420944214,\n", - " -0.5970017910003662,\n", - " -0.7013629078865051,\n", - " -0.6733680367469788,\n", - " -0.5991628766059875,\n", - " -0.4928997755050659,\n", - " -0.43535569310188293,\n", - " -0.2948397099971771,\n", - " -0.08969184011220932,\n", - " 0.017037030309438705,\n", - " 0.009265410713851452,\n", - " 0.08223278820514679,\n", - " 0.11088345944881439,\n", - " 0.10598336160182953,\n", - " 0.020693982020020485,\n", - " -0.03811557590961456,\n", - " 0.01977136731147766,\n", - " 0.1792643815279007,\n", - " 0.18503890931606293,\n", - " 0.13014572858810425,\n", - " 0.20541326701641083,\n", - " 0.2528674900531769,\n", - " 0.29493963718414307,\n", - " 0.20452891290187836,\n", - " 0.14813914895057678,\n", - " 0.15098601579666138],\n", - " 'y_shifts': [0.12666521966457367,\n", - " 0.10234441608190536,\n", - " -3.13407301902771,\n", - " -3.6592633724212646,\n", - " -4.18445348739624,\n", - " -4.688701152801514,\n", - " -5.235147476196289,\n", - " -5.755228519439697,\n", - " -6.249597072601318,\n", - " -6.733824253082275,\n", - " -7.194030284881592,\n", - " -7.576948165893555,\n", - " -7.7993574142456055,\n", - " -7.994346618652344,\n", - " -8.127166748046875,\n", - " -8.138824462890625,\n", - " -8.065093040466309,\n", - " -7.557020664215088,\n", - " -6.891330242156982,\n", - " -6.161072731018066,\n", - " -5.346907138824463,\n", - " -4.473868370056152,\n", - " -3.673264980316162,\n", - " -2.8656222820281982,\n", - " -2.39850115776062,\n", - " -2.0217411518096924,\n", - " -1.8337023258209229,\n", - " -1.6693402528762817,\n", - " -1.5221328735351562,\n", - " -1.2807585000991821,\n", - " -1.0921361446380615,\n", - " -0.9784722328186035,\n", - " -0.9531892538070679,\n", - " -0.7300593256950378,\n", - " -0.5158997774124146,\n", - " -0.3833550810813904,\n", - " -0.3575448989868164,\n", - " -0.2777341306209564,\n", - " -0.1431356519460678,\n", - " 0.0,\n", - " 0.018062883988022804,\n", - " 0.02024957165122032,\n", - " 0.1286075860261917,\n", - " 0.2630205750465393,\n", - " 0.41762176156044006,\n", - " 0.5669056177139282,\n", - " 0.7509158253669739,\n", - " 0.9652332663536072,\n", - " 1.1854526996612549,\n", - " 1.3385249376296997,\n", - " 1.5836176872253418,\n", - " 1.6928735971450806,\n", - " 1.7169568538665771,\n", - " 1.7339390516281128,\n", - " 1.7620089054107666,\n", - " 1.803458333015442,\n", - " 1.8698025941848755,\n", - " 1.801814317703247,\n", - " 1.8130598068237305,\n", - " 1.915158987045288,\n", - " 1.9755765199661255,\n", - " 2.046341896057129,\n", - " 2.15537691116333,\n", - " 2.259573221206665,\n", - " 2.3934953212738037,\n", - " 2.4974966049194336,\n", - " 2.5491645336151123,\n", - " 2.7047696113586426,\n", - " 2.8032662868499756,\n", - " 2.829847812652588,\n", - " 2.865462303161621,\n", - " 2.9022300243377686,\n", - " 2.976571798324585],\n", - " 'orig_x': 3,\n", - " 'orig_y': 2,\n", - " 'crop_x': 3,\n", - " 'crop_y': 3},\n", - " {'parameter_index': 7,\n", - " 'x_shifts': [-3.2353169918060303,\n", - " -3.323707342147827,\n", - " -3.412097930908203,\n", - " -3.445274591445923,\n", - " -3.5706067085266113,\n", - " -3.6147446632385254,\n", - " -3.835041046142578,\n", - " -4.116334915161133,\n", - " -4.2444281578063965,\n", - " -3.118717670440674,\n", - " -1.8643231391906738,\n", - " -0.5436257123947144,\n", - " 0.8571304082870483,\n", - " 2.3702166080474854,\n", - " 3.9033632278442383,\n", - " 5.263365268707275,\n", - " 5.353668689727783,\n", - " 5.474268436431885,\n", - " 5.459122657775879,\n", - " 5.244235515594482,\n", - " 5.044277667999268,\n", - " 4.883549690246582,\n", - " 4.735608100891113,\n", - " 4.506298542022705,\n", - " 4.102126598358154,\n", - " 3.7667860984802246,\n", - " 3.5312862396240234,\n", - " 3.2341909408569336,\n", - " 2.8567590713500977,\n", - " 2.5022292137145996,\n", - " 2.1855626106262207,\n", - " 1.9237905740737915,\n", - " 1.5663813352584839,\n", - " 1.2521204948425293,\n", - " 0.9584168195724487,\n", - " 0.674347996711731,\n", - " 0.3258218467235565,\n", - " 0.0,\n", - " -0.2851730287075043,\n", - " -0.5623912811279297,\n", - " -0.9368544220924377,\n", - " -1.3531619310379028,\n", - " -1.6455492973327637,\n", - " -1.8983808755874634,\n", - " -2.1459438800811768,\n", - " -2.5011255741119385,\n", - " -2.6492526531219482,\n", - " -2.7248406410217285,\n", - " -2.7899363040924072,\n", - " -2.961854934692383,\n", - " -3.0842220783233643,\n", - " -3.1700172424316406,\n", - " -3.1605796813964844,\n", - " -3.3739209175109863,\n", - " -3.6244757175445557,\n", - " -3.733959197998047,\n", - " -3.8082921504974365,\n", - " -3.91127347946167,\n", - " -3.986147880554199,\n", - " -3.93538498878479,\n", - " -3.79839825630188,\n", - " -3.6527819633483887,\n", - " -3.609999656677246,\n", - " -3.502998113632202,\n", - " -3.299318313598633,\n", - " -3.213853359222412,\n", - " -3.3452084064483643,\n", - " -3.4400246143341064,\n", - " -3.4914486408233643,\n", - " -3.5539023876190186,\n", - " -3.772982358932495,\n", - " -4.021112442016602,\n", - " -4.226666450500488],\n", - " 'y_shifts': [-4.429752826690674,\n", - " -4.632839202880859,\n", - " -7.468558311462402,\n", - " -6.606112957000732,\n", - " -5.7436676025390625,\n", - " -4.792471885681152,\n", - " -3.919013261795044,\n", - " -3.1925933361053467,\n", - " -2.4479458332061768,\n", - " -1.6934419870376587,\n", - " -1.203624963760376,\n", - " -2.499119758605957,\n", - " -3.9422144889831543,\n", - " -5.401631832122803,\n", - " -6.844740390777588,\n", - " -8.254131317138672,\n", - " -9.678665161132812,\n", - " -10.823237419128418,\n", - " -10.20181941986084,\n", - " -9.475326538085938,\n", - " -8.690711975097656,\n", - " -7.866300106048584,\n", - " -7.089316368103027,\n", - " -6.365290641784668,\n", - " -5.7469658851623535,\n", - " -5.1380615234375,\n", - " -4.5272908210754395,\n", - " -3.9420998096466064,\n", - " -3.4466285705566406,\n", - " -3.012317180633545,\n", - " -2.5922133922576904,\n", - " -2.216158151626587,\n", - " -1.9115447998046875,\n", - " -1.6313321590423584,\n", - " -1.3545725345611572,\n", - " -1.0780116319656372,\n", - " -0.8126819133758545,\n", - " -0.5582671165466309,\n", - " -0.2880484461784363,\n", - " 0.0,\n", - " 0.21826688945293427,\n", - " 0.39547768235206604,\n", - " 0.5797901153564453,\n", - " 0.745426595211029,\n", - " 0.8714649081230164,\n", - " 0.9517098665237427,\n", - " 1.0516974925994873,\n", - " 1.206262469291687,\n", - " 1.2736799716949463,\n", - " 1.3295166492462158,\n", - " 1.408537745475769,\n", - " 1.5210267305374146,\n", - " 1.6057405471801758,\n", - " 1.6216611862182617,\n", - " 1.6043152809143066,\n", - " 1.6964359283447266,\n", - " 1.765428900718689,\n", - " 1.7887698411941528,\n", - " 1.809860348701477,\n", - " 1.8780268430709839,\n", - " 1.9199885129928589,\n", - " 1.8071309328079224,\n", - " 1.6719735860824585,\n", - " 1.579107642173767,\n", - " 1.583925485610962,\n", - " 1.5787156820297241,\n", - " 1.5541603565216064,\n", - " 1.6312270164489746,\n", - " 1.8826298713684082,\n", - " 2.1137518882751465,\n", - " 2.2931923866271973,\n", - " 2.441556215286255,\n", - " 2.6357312202453613],\n", - " 'orig_x': 2,\n", - " 'orig_y': 3,\n", - " 'crop_x': 3,\n", - " 'crop_y': 3},\n", - " {'parameter_index': 4,\n", - " 'x_shifts': [-2.610868215560913,\n", - " -2.3991987705230713,\n", - " -2.1875295639038086,\n", - " -1.940303921699524,\n", - " -1.7284486293792725,\n", - " -1.5753180980682373,\n", - " -1.4567230939865112,\n", - " -1.278201937675476,\n", - " -1.1984541416168213,\n", - " -1.204375147819519,\n", - " -1.112607479095459,\n", - " -1.0080002546310425,\n", - " -0.9728265404701233,\n", - " -1.0170142650604248,\n", - " -0.9838652610778809,\n", - " -0.9330941438674927,\n", - " -0.8358398079872131,\n", - " -0.889604926109314,\n", - " -0.8955700397491455,\n", - " -0.8319675326347351,\n", - " -0.6631752848625183,\n", - " -0.6654435396194458,\n", - " -0.7055371999740601,\n", - " -0.6379931569099426,\n", - " -0.5040674209594727,\n", - " -0.4046576917171478,\n", - " -0.3917524516582489,\n", - " -0.3356744349002838,\n", - " -0.27372270822525024,\n", - " -0.19185125827789307,\n", - " -0.2592553198337555,\n", - " -0.25915512442588806,\n", - " -0.23015806078910828,\n", - " -0.18469378352165222,\n", - " -0.22171521186828613,\n", - " -0.23227594792842865,\n", - " -0.1115185022354126,\n", - " 0.0,\n", - " -0.03019038587808609,\n", - " -0.10173993557691574,\n", - " -0.03888905420899391,\n", - " 0.03420216962695122,\n", - " 0.11698676645755768,\n", - " 0.056941621005535126,\n", - " 0.1042783111333847,\n", - " 0.21657820045948029,\n", - " 0.3332734704017639,\n", - " 0.25309303402900696,\n", - " 0.2129117250442505,\n", - " 0.2742883861064911,\n", - " 0.36858272552490234,\n", - " 0.37058091163635254,\n", - " 0.3533990681171417,\n", - " 0.4175761640071869,\n", - " 0.5694120526313782,\n", - " 0.6304082274436951,\n", - " 0.6175978183746338,\n", - " 0.637672483921051,\n", - " 0.7479968667030334,\n", - " 0.8431146740913391,\n", - " 0.8083204030990601,\n", - " 0.88791823387146,\n", - " 0.9984904527664185,\n", - " 1.153871774673462,\n", - " 1.221043348312378,\n", - " 1.2271231412887573,\n", - " 1.2827532291412354,\n", - " 1.3712105751037598,\n", - " 1.2875797748565674,\n", - " 1.2475649118423462,\n", - " 1.1655848026275635,\n", - " 1.1436070203781128,\n", - " 1.102277398109436],\n", - " 'y_shifts': [1.063166618347168,\n", - " 1.0240558385849,\n", - " -8.923955917358398,\n", - " -8.161184310913086,\n", - " -7.398411273956299,\n", - " -6.44649600982666,\n", - " -5.725879669189453,\n", - " -5.0990118980407715,\n", - " -4.666102886199951,\n", - " -4.395227432250977,\n", - " -4.07960319519043,\n", - " -3.8682913780212402,\n", - " -3.693753957748413,\n", - " -3.5557916164398193,\n", - " -3.3316941261291504,\n", - " -3.1067399978637695,\n", - " -2.855823516845703,\n", - " -2.6868340969085693,\n", - " -2.4777886867523193,\n", - " -2.270864248275757,\n", - " -2.1261024475097656,\n", - " -1.9502159357070923,\n", - " -1.9497637748718262,\n", - " -1.7774224281311035,\n", - " -1.6179757118225098,\n", - " -1.5387343168258667,\n", - " -1.427469253540039,\n", - " -1.2616122961044312,\n", - " -1.1150494813919067,\n", - " -1.0491163730621338,\n", - " -0.9373945593833923,\n", - " -0.8839041590690613,\n", - " -0.6979785561561584,\n", - " -0.6097335815429688,\n", - " -0.5832770466804504,\n", - " -0.4891015291213989,\n", - " -0.2038470208644867,\n", - " -0.1100410521030426,\n", - " -0.029066137969493866,\n", - " 0.0,\n", - " 0.16608543694019318,\n", - " 0.3379284739494324,\n", - " 0.3754288852214813,\n", - " 0.41712692379951477,\n", - " 0.47750306129455566,\n", - " 0.5644425749778748,\n", - " 0.660500168800354,\n", - " 0.6717073917388916,\n", - " 0.7049923539161682,\n", - " 0.8017879724502563,\n", - " 0.8681222200393677,\n", - " 0.884330153465271,\n", - " 0.9132882952690125,\n", - " 0.9348047375679016,\n", - " 1.0265337228775024,\n", - " 1.0064127445220947,\n", - " 0.9679259061813354,\n", - " 0.9652919769287109,\n", - " 0.9888889193534851,\n", - " 0.9367400407791138,\n", - " 0.894470751285553,\n", - " 0.8746671676635742,\n", - " 0.9342670440673828,\n", - " 0.876309871673584,\n", - " 0.8726969361305237,\n", - " 0.8112783432006836,\n", - " 0.7419235110282898,\n", - " 0.7724853157997131,\n", - " 0.7997227311134338,\n", - " 0.7361430525779724,\n", - " 0.8777557611465454,\n", - " 0.8195359706878662,\n", - " 0.9225239157676697],\n", - " 'orig_x': 1,\n", - " 'orig_y': 1,\n", - " 'crop_x': 1,\n", - " 'crop_y': 1},\n", - " {'parameter_index': 2,\n", - " 'x_shifts': [-8.615528106689453,\n", - " -7.356380462646484,\n", - " -6.097233295440674,\n", - " -4.713377475738525,\n", - " -3.411404609680176,\n", - " -2.401987075805664,\n", - " -1.4963769912719727,\n", - " -0.7021447420120239,\n", - " -0.004531494807451963,\n", - " 0.39201706647872925,\n", - " 0.6804953217506409,\n", - " 0.8823150396347046,\n", - " 0.9960319995880127,\n", - " 0.9717599749565125,\n", - " 0.8510860204696655,\n", - " 0.8146162033081055,\n", - " 0.7631222009658813,\n", - " 0.6974408030509949,\n", - " 0.5770274996757507,\n", - " 0.5889213681221008,\n", - " 0.5875079035758972,\n", - " 0.6509720087051392,\n", - " 0.5497119426727295,\n", - " 0.5680451989173889,\n", - " 0.6806340217590332,\n", - " 0.8175390958786011,\n", - " 0.7098214626312256,\n", - " 0.626185417175293,\n", - " 0.6277220845222473,\n", - " 0.6380399465560913,\n", - " 0.5897746086120605,\n", - " 0.41380855441093445,\n", - " 0.32234445214271545,\n", - " 0.3138793408870697,\n", - " 0.2740429639816284,\n", - " 0.08753170818090439,\n", - " 0.02295014262199402,\n", - " 0.0,\n", - " 0.053497374057769775,\n", - " -0.03412969410419464,\n", - " -0.13116413354873657,\n", - " -0.1467651128768921,\n", - " -0.13539093732833862,\n", - " -0.22189314663410187,\n", - " -0.35391858220100403,\n", - " -0.3815167546272278,\n", - " -0.4072968661785126,\n", - " -0.44459763169288635,\n", - " -0.5683586597442627,\n", - " -0.6075567603111267,\n", - " -0.5980318784713745,\n", - " -0.5695956945419312,\n", - " -0.6961965560913086,\n", - " -0.7740435600280762,\n", - " -0.75483238697052,\n", - " -0.721149742603302,\n", - " -0.7908901572227478,\n", - " -0.8740857839584351,\n", - " -0.8263962268829346,\n", - " -0.8684363961219788,\n", - " -0.9427087306976318,\n", - " -1.1214488744735718,\n", - " -1.2068917751312256,\n", - " -1.2207295894622803,\n", - " -1.3266074657440186,\n", - " -1.5592529773712158,\n", - " -1.62368905544281,\n", - " -1.7520732879638672,\n", - " -1.8013023138046265,\n", - " -1.9850661754608154,\n", - " -2.1605780124664307,\n", - " -2.2935850620269775,\n", - " -2.4520864486694336],\n", - " 'y_shifts': [-2.6043436527252197,\n", - " -2.756601095199585,\n", - " -5.694303512573242,\n", - " -5.985551357269287,\n", - " -6.27679967880249,\n", - " -6.562056064605713,\n", - " -6.923076152801514,\n", - " -7.1727776527404785,\n", - " -7.399988174438477,\n", - " -7.538243293762207,\n", - " -7.588183403015137,\n", - " -7.368414402008057,\n", - " -6.944260120391846,\n", - " -6.411024570465088,\n", - " -5.893171310424805,\n", - " -5.333687782287598,\n", - " -4.737798690795898,\n", - " -4.232797622680664,\n", - " -3.784087657928467,\n", - " -3.410846471786499,\n", - " -3.0439682006835938,\n", - " -2.7615928649902344,\n", - " -2.465609073638916,\n", - " -2.2196853160858154,\n", - " -1.9492837190628052,\n", - " -1.7567538022994995,\n", - " -1.5912615060806274,\n", - " -1.4916166067123413,\n", - " -1.2629647254943848,\n", - " -1.0676822662353516,\n", - " -0.9881698489189148,\n", - " -0.8401653170585632,\n", - " -0.7137073874473572,\n", - " -0.5452827215194702,\n", - " -0.4504009783267975,\n", - " -0.3930903375148773,\n", - " -0.3568609058856964,\n", - " -0.1684224009513855,\n", - " -0.09787970781326294,\n", - " 0.0,\n", - " 0.050118785351514816,\n", - " 0.22124694287776947,\n", - " 0.3988342881202698,\n", - " 0.5117274522781372,\n", - " 0.5848167538642883,\n", - " 0.7377188205718994,\n", - " 0.9210578799247742,\n", - " 1.043439507484436,\n", - " 1.1505175828933716,\n", - " 1.2370343208312988,\n", - " 1.4525516033172607,\n", - " 1.6336699724197388,\n", - " 1.779062271118164,\n", - " 1.8390886783599854,\n", - " 1.9483367204666138,\n", - " 2.058267116546631,\n", - " 2.1324775218963623,\n", - " 2.1076836585998535,\n", - " 2.094212770462036,\n", - " 2.0776305198669434,\n", - " 2.046207904815674,\n", - " 2.161494731903076,\n", - " 2.233645439147949,\n", - " 2.327598810195923,\n", - " 2.4326062202453613,\n", - " 2.487269401550293,\n", - " 2.6425540447235107,\n", - " 2.825223207473755,\n", - " 2.8198018074035645,\n", - " 2.9282591342926025,\n", - " 2.9886467456817627,\n", - " 3.095370292663574,\n", - " 3.2001500129699707],\n", - " 'orig_x': 3,\n", - " 'orig_y': 3,\n", - " 'crop_x': 3,\n", - " 'crop_y': 3},\n", - " {'parameter_index': 5,\n", - " 'x_shifts': [-9.955230712890625,\n", - " -9.173182487487793,\n", - " -8.391133308410645,\n", - " -7.566523551940918,\n", - " -6.702793598175049,\n", - " -6.113577365875244,\n", - " -5.570380687713623,\n", - " -5.033969402313232,\n", - " -4.516270637512207,\n", - " -4.14048433303833,\n", - " -3.901266574859619,\n", - " -3.6065256595611572,\n", - " -3.2482645511627197,\n", - " -2.9921061992645264,\n", - " -2.82690167427063,\n", - " -2.6253950595855713,\n", - " -2.3579630851745605,\n", - " -2.06659197807312,\n", - " -1.905942440032959,\n", - " -1.7735233306884766,\n", - " -1.5824592113494873,\n", - " -1.3919181823730469,\n", - " -1.2152392864227295,\n", - " -1.0983165502548218,\n", - " -0.940520703792572,\n", - " -0.7952488660812378,\n", - " -0.714165985584259,\n", - " -0.6745748519897461,\n", - " -0.55689936876297,\n", - " -0.4867720603942871,\n", - " -0.47738373279571533,\n", - " -0.5575375556945801,\n", - " -0.48297861218452454,\n", - " -0.3529837727546692,\n", - " -0.24884195625782013,\n", - " -0.3084444999694824,\n", - " -0.23649859428405762,\n", - " 0.0,\n", - " 0.23794369399547577,\n", - " 0.3306899070739746,\n", - " 0.3210298418998718,\n", - " 0.41467949748039246,\n", - " 0.6314889192581177,\n", - " 0.7493927478790283,\n", - " 0.6887310147285461,\n", - " 0.7082467675209045,\n", - " 0.775310218334198,\n", - " 0.8989430665969849,\n", - " 0.9034848213195801,\n", - " 1.046369194984436,\n", - " 1.1638002395629883,\n", - " 1.2581441402435303,\n", - " 1.2372723817825317,\n", - " 1.2592729330062866,\n", - " 1.3542262315750122,\n", - " 1.5136449337005615,\n", - " 1.4556926488876343,\n", - " 1.4454753398895264,\n", - " 1.574407935142517,\n", - " 1.7678567171096802,\n", - " 1.8718652725219727,\n", - " 1.820082664489746,\n", - " 1.8518112897872925,\n", - " 1.956780195236206,\n", - " 2.021101474761963,\n", - " 2.050206184387207,\n", - " 2.0859553813934326,\n", - " 2.2282819747924805,\n", - " 2.43056583404541,\n", - " 2.480408191680908,\n", - " 2.5457282066345215,\n", - " 2.6778831481933594,\n", - " 2.720106601715088],\n", - " 'y_shifts': [2.8057658672332764,\n", - " 2.891425609588623,\n", - " -1.3903954029083252,\n", - " -1.8688337802886963,\n", - " -2.3472721576690674,\n", - " -2.873831272125244,\n", - " -3.3783273696899414,\n", - " -3.783778190612793,\n", - " -4.151655197143555,\n", - " -4.521784782409668,\n", - " -4.475244045257568,\n", - " -4.30681848526001,\n", - " -4.163033485412598,\n", - " -4.081902503967285,\n", - " -4.064126014709473,\n", - " -4.0282511711120605,\n", - " -3.8041598796844482,\n", - " -3.6762731075286865,\n", - " -3.6661806106567383,\n", - " -3.620605230331421,\n", - " -3.5025622844696045,\n", - " -3.397791862487793,\n", - " -3.358572244644165,\n", - " -3.434905529022217,\n", - " -3.5130136013031006,\n", - " -3.3494067192077637,\n", - " -2.976058006286621,\n", - " -2.645522117614746,\n", - " -2.28554630279541,\n", - " -1.8555419445037842,\n", - " -1.4251927137374878,\n", - " -1.1505669355392456,\n", - " -0.8520401120185852,\n", - " -0.7312326431274414,\n", - " -0.6467510461807251,\n", - " -0.5548804998397827,\n", - " -0.500904381275177,\n", - " -0.16700638830661774,\n", - " 0.04822837933897972,\n", - " 0.0,\n", - " -0.07520459592342377,\n", - " -0.03892872855067253,\n", - " 0.3524917960166931,\n", - " 0.6867384314537048,\n", - " 0.6623265743255615,\n", - " 0.6108484268188477,\n", - " 0.7764386534690857,\n", - " 1.1123732328414917,\n", - " 1.3375455141067505,\n", - " 1.158821940422058,\n", - " 1.0730626583099365,\n", - " 1.1281332969665527,\n", - " 1.2784637212753296,\n", - " 1.392671823501587,\n", - " 1.5173412561416626,\n", - " 1.6246341466903687,\n", - " 1.7116788625717163,\n", - " 1.8189464807510376,\n", - " 1.9506944417953491,\n", - " 2.064049005508423,\n", - " 2.086395263671875,\n", - " 1.9975030422210693,\n", - " 2.1185247898101807,\n", - " 2.494232654571533,\n", - " 2.824915885925293,\n", - " 2.9473414421081543,\n", - " 2.980909585952759,\n", - " 2.980302095413208,\n", - " 2.978943109512329,\n", - " 2.970418930053711,\n", - " 2.8637099266052246,\n", - " 2.840456008911133,\n", - " 2.9142255783081055],\n", - " 'orig_x': 3,\n", - " 'orig_y': 3,\n", - " 'crop_x': 3,\n", - " 'crop_y': 3},\n", - " {'parameter_index': 8,\n", - " 'x_shifts': [-0.23477153480052948,\n", - " -0.1808518022298813,\n", - " -0.1269320696592331,\n", - " -0.053719718009233475,\n", - " -0.0006071985699236393,\n", - " 0.03776078671216965,\n", - " -0.03924238309264183,\n", - " -0.06660795211791992,\n", - " -0.06807062029838562,\n", - " -0.06010524183511734,\n", - " -0.14385701715946198,\n", - " -0.14044369757175446,\n", - " -0.06844877451658249,\n", - " 0.01079469732940197,\n", - " -0.02519889362156391,\n", - " -0.10178527235984802,\n", - " -0.06633464246988297,\n", - " 0.0011623334139585495,\n", - " -0.015262543223798275,\n", - " -0.13240157067775726,\n", - " -0.1579919457435608,\n", - " -0.08760242909193039,\n", - " 0.024849677458405495,\n", - " 0.011334962211549282,\n", - " 0.035854097455739975,\n", - " 0.09190193563699722,\n", - " 0.14018692076206207,\n", - " 0.04824294149875641,\n", - " -0.015284971334040165,\n", - " 0.0002387290878687054,\n", - " 0.04361994192004204,\n", - " -0.007871785201132298,\n", - " -0.049027785658836365,\n", - " 0.011659633368253708,\n", - " 0.10351260006427765,\n", - " 0.13183636963367462,\n", - " 0.02494857646524906,\n", - " 0.0,\n", - " 0.08891868591308594,\n", - " 0.10604529827833176,\n", - " -0.0033578642178326845,\n", - " -0.03281944990158081,\n", - " 0.005925464443862438,\n", - " 0.07796204835176468,\n", - " 0.08556471019983292,\n", - " 0.0537450835108757,\n", - " 0.1264611780643463,\n", - " 0.24118134379386902,\n", - " 0.29293176531791687,\n", - " 0.2581407129764557,\n", - " 0.31907063722610474,\n", - " 0.3629549741744995,\n", - " 0.3613341748714447,\n", - " 0.2733973264694214,\n", - " 0.2494693547487259,\n", - " 0.2845989465713501,\n", - " 0.34726884961128235,\n", - " 0.27712541818618774,\n", - " 0.2590142786502838,\n", - " 0.2761459946632385,\n", - " 0.31020650267601013,\n", - " 0.2265913486480713,\n", - " 0.07105838507413864,\n", - " 0.0027471836656332016,\n", - " -0.032079268246889114,\n", - " -0.1500830054283142,\n", - " -0.2719610631465912,\n", - " -0.2967137396335602,\n", - " -0.2594560384750366,\n", - " -0.21811732649803162,\n", - " -0.3361721932888031,\n", - " -0.3876759707927704,\n", - " -0.4823509752750397],\n", - " 'y_shifts': [-0.5545130968093872,\n", - " -0.6266752481460571,\n", - " -12.572406768798828,\n", - " -12.194982528686523,\n", - " -11.817558288574219,\n", - " -11.485780715942383,\n", - " -11.081584930419922,\n", - " -10.713419914245605,\n", - " -10.266297340393066,\n", - " -9.827253341674805,\n", - " -9.39794635772705,\n", - " -8.967375755310059,\n", - " -8.517165184020996,\n", - " -8.091689109802246,\n", - " -7.707918643951416,\n", - " -7.315011978149414,\n", - " -6.909842491149902,\n", - " -6.500581741333008,\n", - " -6.158762454986572,\n", - " -5.8219804763793945,\n", - " -5.477792263031006,\n", - " -5.118106842041016,\n", - " -4.797227382659912,\n", - " -4.514651775360107,\n", - " -4.248589515686035,\n", - " -3.918131113052368,\n", - " -3.6401240825653076,\n", - " -3.3945224285125732,\n", - " -3.188267469406128,\n", - " -2.948883295059204,\n", - " -2.6815786361694336,\n", - " -2.422706365585327,\n", - " -2.181464433670044,\n", - " -1.8846355676651,\n", - " -1.5535765886306763,\n", - " -1.2153483629226685,\n", - " -0.9406549334526062,\n", - " -0.6342993974685669,\n", - " -0.29770150780677795,\n", - " 0.0,\n", - " 0.2658239006996155,\n", - " 0.5342919826507568,\n", - " 0.8247504234313965,\n", - " 1.1408445835113525,\n", - " 1.3938868045806885,\n", - " 1.6589182615280151,\n", - " 1.9352492094039917,\n", - " 2.213538408279419,\n", - " 2.4713423252105713,\n", - " 2.7284388542175293,\n", - " 3.013859987258911,\n", - " 3.332052230834961,\n", - " 3.583573341369629,\n", - " 3.840315103530884,\n", - " 4.13369083404541,\n", - " 4.34566068649292,\n", - " 4.481683254241943,\n", - " 4.547482013702393,\n", - " 4.546810626983643,\n", - " 4.603362560272217,\n", - " 4.6249098777771,\n", - " 4.629193305969238,\n", - " 4.681220054626465,\n", - " 4.843320369720459,\n", - " 5.087356090545654,\n", - " 5.381232738494873,\n", - " 5.643945693969727,\n", - " 5.969758987426758,\n", - " 6.289839267730713,\n", - " 6.645534038543701,\n", - " 6.915322780609131,\n", - " 7.158918380737305,\n", - " 7.430899620056152],\n", - " 'orig_x': 7,\n", - " 'orig_y': 7,\n", - " 'crop_x': 8,\n", - " 'crop_y': 8},\n", - " {'parameter_index': 3,\n", - " 'x_shifts': [-4.084181785583496,\n", - " -4.129850387573242,\n", - " -4.1755194664001465,\n", - " -4.212072372436523,\n", - " -4.28886604309082,\n", - " -4.340521335601807,\n", - " -4.388678073883057,\n", - " -4.345812797546387,\n", - " -4.460831642150879,\n", - " -4.5170793533325195,\n", - " -4.452273368835449,\n", - " -4.3583831787109375,\n", - " -4.3983378410339355,\n", - " -4.406713008880615,\n", - " -4.310275554656982,\n", - " -4.208436965942383,\n", - " -4.161254405975342,\n", - " -4.1412458419799805,\n", - " -4.0305070877075195,\n", - " -3.8350937366485596,\n", - " -3.668208599090576,\n", - " -3.560683012008667,\n", - " -3.344693422317505,\n", - " -3.065690755844116,\n", - " -2.784938097000122,\n", - " -2.6223654747009277,\n", - " -2.4113898277282715,\n", - " -2.168973922729492,\n", - " -1.9497891664505005,\n", - " -1.8140175342559814,\n", - " -1.6523802280426025,\n", - " -1.402131199836731,\n", - " -1.096197247505188,\n", - " -0.8881446123123169,\n", - " -0.7082642912864685,\n", - " -0.44816485047340393,\n", - " -0.2056349366903305,\n", - " 0.0,\n", - " 0.1542818397283554,\n", - " 0.36519917845726013,\n", - " 0.6135237812995911,\n", - " 0.9200049638748169,\n", - " 1.168619155883789,\n", - " 1.4415403604507446,\n", - " 1.7402311563491821,\n", - " 1.979686975479126,\n", - " 2.1345856189727783,\n", - " 2.3262650966644287,\n", - " 2.633129835128784,\n", - " 2.887810230255127,\n", - " 3.1071298122406006,\n", - " 3.2438764572143555,\n", - " 3.510664224624634,\n", - " 3.8270211219787598,\n", - " 4.125382423400879,\n", - " 4.264741897583008,\n", - " 4.463541507720947,\n", - " 4.755345821380615,\n", - " 5.069525241851807,\n", - " 5.272917747497559,\n", - " 5.4523844718933105,\n", - " 5.747475624084473,\n", - " 6.0065016746521,\n", - " 6.284268379211426,\n", - " 6.444004535675049,\n", - " 6.747565269470215,\n", - " 7.035738468170166,\n", - " 7.3910231590271,\n", - " 7.560550689697266,\n", - " 7.916225433349609,\n", - " 8.267723083496094,\n", - " 8.729472160339355,\n", - " 9.1939058303833],\n", - " 'y_shifts': [9.618898391723633,\n", - " 10.043889999389648,\n", - " -8.838666915893555,\n", - " -8.09433364868164,\n", - " -7.34999942779541,\n", - " -6.478841781616211,\n", - " -5.731070518493652,\n", - " -5.156826972961426,\n", - " -4.735250949859619,\n", - " -4.357757091522217,\n", - " -4.027462959289551,\n", - " -3.7518255710601807,\n", - " -3.5611350536346436,\n", - " -3.3812739849090576,\n", - " -3.1777610778808594,\n", - " -3.0086214542388916,\n", - " -2.8538918495178223,\n", - " -2.745568037033081,\n", - " -2.6005265712738037,\n", - " -2.4037184715270996,\n", - " -2.2744617462158203,\n", - " -2.1879935264587402,\n", - " -2.0745794773101807,\n", - " -1.9514998197555542,\n", - " -1.840156078338623,\n", - " -1.7690839767456055,\n", - " -1.7057393789291382,\n", - " -1.5648341178894043,\n", - " -1.4512087106704712,\n", - " -1.3772937059402466,\n", - " -1.2997393608093262,\n", - " -1.1647931337356567,\n", - " -0.9855641722679138,\n", - " -0.8414701223373413,\n", - " -0.7228052020072937,\n", - " -0.5606274604797363,\n", - " -0.36077430844306946,\n", - " -0.24141129851341248,\n", - " -0.09450245648622513,\n", - " 0.0,\n", - " 0.1461554318666458,\n", - " 0.26371684670448303,\n", - " 0.32069599628448486,\n", - " 0.3719806373119354,\n", - " 0.535847008228302,\n", - " 0.6174238324165344,\n", - " 0.6978768110275269,\n", - " 0.764534592628479,\n", - " 0.892461895942688,\n", - " 1.0717203617095947,\n", - " 1.2344295978546143,\n", - " 1.3509509563446045,\n", - " 1.5008594989776611,\n", - " 1.6861498355865479,\n", - " 1.8321690559387207,\n", - " 1.948607325553894,\n", - " 2.0879011154174805,\n", - " 2.2531087398529053,\n", - " 2.3734960556030273,\n", - " 2.496580123901367,\n", - " 2.635286808013916,\n", - " 2.7903435230255127,\n", - " 2.934638500213623,\n", - " 3.088914155960083,\n", - " 3.1842763423919678,\n", - " 3.318230628967285,\n", - " 3.4723312854766846,\n", - " 3.5625157356262207,\n", - " 3.6622560024261475,\n", - " 3.798865556716919,\n", - " 3.931124210357666,\n", - " 4.063887119293213,\n", - " 4.242593765258789],\n", - " 'orig_x': 4,\n", - " 'orig_y': 4,\n", - " 'crop_x': 4,\n", - " 'crop_y': 4},\n", - " {'parameter_index': 9,\n", - " 'x_shifts': [-3.324209690093994,\n", - " -2.8946692943573,\n", - " -2.4651286602020264,\n", - " -1.9968671798706055,\n", - " -1.4539217948913574,\n", - " -1.2457231283187866,\n", - " -1.0717878341674805,\n", - " -0.8505513668060303,\n", - " -0.6362730264663696,\n", - " -0.47162926197052,\n", - " -0.445892870426178,\n", - " -0.41609862446784973,\n", - " -0.2904415726661682,\n", - " -0.2169654816389084,\n", - " -0.25948429107666016,\n", - " -0.28640568256378174,\n", - " -0.2545658349990845,\n", - " -0.21312163770198822,\n", - " -0.2505839169025421,\n", - " -0.2766924798488617,\n", - " -0.2644469141960144,\n", - " -0.16130231320858002,\n", - " -0.09977054595947266,\n", - " -0.06294765323400497,\n", - " 0.004959187936037779,\n", - " 0.12335681915283203,\n", - " 0.13954566419124603,\n", - " 0.12352300435304642,\n", - " 0.13664855062961578,\n", - " 0.19268888235092163,\n", - " 0.20895598828792572,\n", - " 0.10461011528968811,\n", - " 0.05588720366358757,\n", - " 0.11525929719209671,\n", - " 0.18039095401763916,\n", - " 0.12351786345243454,\n", - " 0.03582208976149559,\n", - " 0.0,\n", - " 0.051198266446590424,\n", - " -0.02981831692159176,\n", - " -0.11903509497642517,\n", - " -0.16907450556755066,\n", - " -0.14655055105686188,\n", - " -0.11616350710391998,\n", - " -0.1702345758676529,\n", - " -0.19899910688400269,\n", - " -0.1943301260471344,\n", - " -0.24037551879882812,\n", - " -0.33929139375686646,\n", - " -0.42549943923950195,\n", - " -0.48453450202941895,\n", - " -0.47096678614616394,\n", - " -0.5519493818283081,\n", - " -0.548618495464325,\n", - " -0.4435528516769409,\n", - " -0.3647027015686035,\n", - " -0.39094078540802,\n", - " -0.43254634737968445,\n", - " -0.3817429542541504,\n", - " -0.2765307128429413,\n", - " -0.27274730801582336,\n", - " -0.35494348406791687,\n", - " -0.3295094668865204,\n", - " -0.22616350650787354,\n", - " -0.142409086227417,\n", - " -0.2394418567419052,\n", - " -0.2609453797340393,\n", - " -0.25466370582580566,\n", - " -0.2206016182899475,\n", - " -0.30863770842552185,\n", - " -0.3415808081626892,\n", - " -0.30185917019844055,\n", - " -0.2530535161495209],\n", - " 'y_shifts': [-0.22364717721939087,\n", - " -0.19424080848693848,\n", - " -15.604676246643066,\n", - " -15.188068389892578,\n", - " -14.771459579467773,\n", - " -14.395586967468262,\n", - " -14.005873680114746,\n", - " -13.499261856079102,\n", - " -12.96080207824707,\n", - " -12.449503898620605,\n", - " -11.975666999816895,\n", - " -11.452651023864746,\n", - " -10.887228012084961,\n", - " -10.379777908325195,\n", - " -9.892139434814453,\n", - " -9.44345760345459,\n", - " -8.939851760864258,\n", - " -8.451777458190918,\n", - " -7.975400447845459,\n", - " -7.523537635803223,\n", - " -7.035688400268555,\n", - " -6.589114189147949,\n", - " -6.1632585525512695,\n", - " -5.811374664306641,\n", - " -5.4356160163879395,\n", - " -5.050010681152344,\n", - " -4.712274551391602,\n", - " -4.4049482345581055,\n", - " -4.08879280090332,\n", - " -3.7403979301452637,\n", - " -3.375744581222534,\n", - " -3.0173962116241455,\n", - " -2.661285400390625,\n", - " -2.229238748550415,\n", - " -1.8609586954116821,\n", - " -1.4982410669326782,\n", - " -1.130223274230957,\n", - " -0.7299515008926392,\n", - " -0.34384968876838684,\n", - " 0.0,\n", - " 0.33225008845329285,\n", - " 0.7502017617225647,\n", - " 1.1736663579940796,\n", - " 1.5387380123138428,\n", - " 1.8851912021636963,\n", - " 2.2043936252593994,\n", - " 2.4941558837890625,\n", - " 2.7493386268615723,\n", - " 2.960761308670044,\n", - " 3.188308000564575,\n", - " 3.4541783332824707,\n", - " 3.6889641284942627,\n", - " 3.923628330230713,\n", - " 4.200503349304199,\n", - " 4.531099796295166,\n", - " 4.837274551391602,\n", - " 5.132848262786865,\n", - " 5.425934791564941,\n", - " 5.783881187438965,\n", - " 6.133332252502441,\n", - " 6.465826988220215,\n", - " 6.751734256744385,\n", - " 7.1186747550964355,\n", - " 7.468418121337891,\n", - " 7.779779434204102,\n", - " 8.028085708618164,\n", - " 8.326202392578125,\n", - " 8.645306587219238,\n", - " 8.956958770751953,\n", - " 9.19900894165039,\n", - " 9.472885131835938,\n", - " 9.803417205810547,\n", - " 10.1321439743042],\n", - " 'orig_x': 10,\n", - " 'orig_y': 10,\n", - " 'crop_x': 10,\n", - " 'crop_y': 11},\n", - " {'parameter_index': 0,\n", - " 'x_shifts': [-22.830398559570312,\n", - " -21.827116012573242,\n", - " -20.82383155822754,\n", - " -19.777711868286133,\n", - " -18.77392578125,\n", - " -17.816789627075195,\n", - " -17.004117965698242,\n", - " -16.12779426574707,\n", - " -15.259818077087402,\n", - " -14.326787948608398,\n", - " -13.675666809082031,\n", - " -12.93709945678711,\n", - " -12.208086013793945,\n", - " -11.423093795776367,\n", - " -10.811103820800781,\n", - " -10.22392749786377,\n", - " -9.559368133544922,\n", - " -8.82421588897705,\n", - " -8.131343841552734,\n", - " -7.506572246551514,\n", - " -6.87577486038208,\n", - " -6.1345014572143555,\n", - " -5.480157852172852,\n", - " -4.94927978515625,\n", - " -4.361110210418701,\n", - " -3.7926032543182373,\n", - " -3.2195630073547363,\n", - " -2.7214653491973877,\n", - " -2.2177042961120605,\n", - " -1.6251932382583618,\n", - " -1.1305692195892334,\n", - " -0.9158328175544739,\n", - " -0.7415340542793274,\n", - " -0.496669203042984,\n", - " -0.23913228511810303,\n", - " -0.1562223732471466,\n", - " -0.14980755746364594,\n", - " 0.0,\n", - " 0.3414795994758606,\n", - " 0.6911119222640991,\n", - " 0.9031574726104736,\n", - " 1.1530890464782715,\n", - " 1.3602981567382812,\n", - " 1.557539463043213,\n", - " 1.6656056642532349,\n", - " 1.6180847883224487,\n", - " 1.5162252187728882,\n", - " 1.2497622966766357,\n", - " 0.897113025188446,\n", - " 0.6712340712547302,\n", - " 0.5562853217124939,\n", - " 0.4235391318798065,\n", - " 0.44410139322280884,\n", - " 0.46661821007728577,\n", - " 0.5629064440727234,\n", - " 0.7113596200942993,\n", - " 0.8664342164993286,\n", - " 0.7137031555175781,\n", - " 0.6118600964546204,\n", - " 0.513210117816925,\n", - " 0.22925934195518494,\n", - " -0.035557057708501816,\n", - " -0.39826270937919617,\n", - " -0.6904374957084656,\n", - " -0.8785273432731628,\n", - " -1.074233889579773,\n", - " -1.3675425052642822,\n", - " -1.5379912853240967,\n", - " -1.6473027467727661,\n", - " -1.641573429107666,\n", - " -1.7971025705337524,\n", - " -1.9143494367599487,\n", - " -1.9401006698608398],\n", - " 'y_shifts': [-2.0299439430236816,\n", - " -2.1197872161865234,\n", - " -8.048166275024414,\n", - " -7.811703205108643,\n", - " -7.575240612030029,\n", - " -7.320317268371582,\n", - " -7.100867748260498,\n", - " -6.858993053436279,\n", - " -6.594812870025635,\n", - " -6.4126482009887695,\n", - " -6.2634053230285645,\n", - " -6.014515399932861,\n", - " -5.763478755950928,\n", - " -5.544980525970459,\n", - " -5.3775506019592285,\n", - " -5.218672752380371,\n", - " -4.997949123382568,\n", - " -4.785706520080566,\n", - " -4.6291303634643555,\n", - " -4.46622896194458,\n", - " -4.288191318511963,\n", - " -4.069650173187256,\n", - " -3.8700599670410156,\n", - " -3.7045438289642334,\n", - " -3.4956932067871094,\n", - " -3.2762136459350586,\n", - " -3.105931282043457,\n", - " -2.9270620346069336,\n", - " -2.7339818477630615,\n", - " -2.5422511100769043,\n", - " -2.3633601665496826,\n", - " -2.222520112991333,\n", - " -2.002638578414917,\n", - " -1.6199204921722412,\n", - " -1.2874599695205688,\n", - " -1.0551759004592896,\n", - " -0.8087448477745056,\n", - " -0.525632381439209,\n", - " -0.220581516623497,\n", - " 0.0,\n", - " 0.08862405270338058,\n", - " 0.1975516378879547,\n", - " 0.3860328793525696,\n", - " 0.53455650806427,\n", - " 0.7411567568778992,\n", - " 0.8818437457084656,\n", - " 1.0095078945159912,\n", - " 1.2350181341171265,\n", - " 1.521964430809021,\n", - " 1.8772274255752563,\n", - " 2.248013973236084,\n", - " 2.508431911468506,\n", - " 2.7790560722351074,\n", - " 3.0435478687286377,\n", - " 3.1765708923339844,\n", - " 3.2463862895965576,\n", - " 3.3099427223205566,\n", - " 3.3848726749420166,\n", - " 3.5064685344696045,\n", - " 3.722632884979248,\n", - " 3.923616647720337,\n", - " 4.131911277770996,\n", - " 4.371645450592041,\n", - " 4.588892936706543,\n", - " 4.839879989624023,\n", - " 5.056504726409912,\n", - " 5.194454193115234,\n", - " 5.328056812286377,\n", - " 5.547990322113037,\n", - " 5.73638391494751,\n", - " 5.884688854217529,\n", - " 5.973821640014648,\n", - " 6.127038955688477],\n", - " 'orig_x': 6,\n", - " 'orig_y': 6,\n", - " 'crop_x': 6,\n", - " 'crop_y': 6},\n", - " {'parameter_index': 6,\n", - " 'x_shifts': [19.16351318359375,\n", - " 18.993698120117188,\n", - " 18.823884963989258,\n", - " 18.805419921875,\n", - " 18.605661392211914,\n", - " 18.289501190185547,\n", - " 18.047517776489258,\n", - " 17.700719833374023,\n", - " 17.283056259155273,\n", - " 16.712427139282227,\n", - " 16.223270416259766,\n", - " 15.765602111816406,\n", - " 15.305419921875,\n", - " 14.74033260345459,\n", - " 14.201045036315918,\n", - " 13.730219841003418,\n", - " 13.311294555664062,\n", - " 12.653290748596191,\n", - " 12.046470642089844,\n", - " 11.418424606323242,\n", - " 10.747210502624512,\n", - " 9.97831916809082,\n", - " 9.098468780517578,\n", - " 8.247047424316406,\n", - " 7.490170001983643,\n", - " 6.633074760437012,\n", - " 5.724954605102539,\n", - " 4.917214393615723,\n", - " 4.118631839752197,\n", - " 3.3037028312683105,\n", - " 2.48526668548584,\n", - " 2.0195534229278564,\n", - " 1.556145191192627,\n", - " 1.1755878925323486,\n", - " 0.7604838013648987,\n", - " 0.4737858176231384,\n", - " 0.260120153427124,\n", - " 0.0,\n", - " -0.6397963762283325,\n", - " -1.2872871160507202,\n", - " -1.863824486732483,\n", - " -2.4469215869903564,\n", - " -3.13515043258667,\n", - " -3.8392295837402344,\n", - " -4.43226432800293,\n", - " -4.864274501800537,\n", - " -5.209940433502197,\n", - " -5.533749103546143,\n", - " -5.681604862213135,\n", - " -5.795083999633789,\n", - " -5.927816390991211,\n", - " -6.226423740386963,\n", - " -6.641604900360107,\n", - " -7.072229862213135,\n", - " -7.584624290466309,\n", - " -8.286615371704102,\n", - " -9.020655632019043,\n", - " -9.689902305603027,\n", - " -10.243130683898926,\n", - " -10.780611991882324,\n", - " -11.309383392333984,\n", - " -11.734482765197754,\n", - " -12.119828224182129,\n", - " -12.417155265808105,\n", - " -12.734189987182617,\n", - " -12.944001197814941,\n", - " -13.00619888305664,\n", - " -12.63168716430664,\n", - " -12.181296348571777,\n", - " -11.56840991973877,\n", - " -10.875456809997559,\n", - " -10.041871070861816,\n", - " -9.166903495788574],\n", - " 'y_shifts': [-8.395576477050781,\n", - " -7.6242499351501465,\n", - " -4.1972174644470215,\n", - " -3.9679129123687744,\n", - " -3.7386088371276855,\n", - " -3.516078233718872,\n", - " -3.2486674785614014,\n", - " -3.0352540016174316,\n", - " -2.7663562297821045,\n", - " -2.5289907455444336,\n", - " -2.2374203205108643,\n", - " -1.9901314973831177,\n", - " -1.8259128332138062,\n", - " -1.6768779754638672,\n", - " -1.4578096866607666,\n", - " -1.2427949905395508,\n", - " -1.0600731372833252,\n", - " -0.9781040549278259,\n", - " -0.9237198233604431,\n", - " -0.7839773297309875,\n", - " -0.68987637758255,\n", - " -0.6449390053749084,\n", - " -0.5811752676963806,\n", - " -0.47424787282943726,\n", - " -0.3612217307090759,\n", - " -0.2546698749065399,\n", - " -0.19621306657791138,\n", - " -0.08956781774759293,\n", - " 0.039420079439878464,\n", - " 0.08612912893295288,\n", - " 0.10838645696640015,\n", - " 0.15608017146587372,\n", - " 0.22400443255901337,\n", - " 0.21059995889663696,\n", - " 0.13519474864006042,\n", - " 0.053201768547296524,\n", - " 0.06230558827519417,\n", - " 0.04477553069591522,\n", - " 0.016291894018650055,\n", - " 0.0,\n", - " 0.11412875354290009,\n", - " 0.21662971377372742,\n", - " 0.3036670386791229,\n", - " 0.34363853931427,\n", - " 0.4287695288658142,\n", - " 0.5068928599357605,\n", - " 0.5321228504180908,\n", - " 0.4903908967971802,\n", - " 0.4908607006072998,\n", - " 0.51120924949646,\n", - " 0.4615628719329834,\n", - " 0.3603062033653259,\n", - " 0.28621646761894226,\n", - " 0.28047803044319153,\n", - " 0.2086828351020813,\n", - " 0.12357628345489502,\n", - " 0.030464695766568184,\n", - " 0.015582253225147724,\n", - " 0.008693546988070011,\n", - " -0.050451092422008514,\n", - " -0.12613075971603394,\n", - " -0.09373076260089874,\n", - " -0.07312732189893723,\n", - " -0.11529835313558578,\n", - " -0.19899405539035797,\n", - " -0.2508833408355713,\n", - " -0.2793976962566376,\n", - " -0.3041742444038391,\n", - " -0.39070138335227966,\n", - " -0.4691920876502991,\n", - " -0.5089803338050842,\n", - " -0.5467424392700195,\n", - " -0.6341865658760071],\n", - " 'orig_x': 0,\n", - " 'orig_y': 0,\n", - " 'crop_x': -1,\n", - " 'crop_y': -1}]" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "results" + "from pycistem.programs import ctffind\n" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "ename": "ZeroDivisionError", - "evalue": "division by zero", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[10], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m unblur\u001b[39m.\u001b[39;49mwrite_results_to_database(database,pars,results)\n", - "File \u001b[0;32m~/pycistem/pycistem/programs/unblur.py:106\u001b[0m, in \u001b[0;36mwrite_results_to_database\u001b[0;34m(database, parameters, results)\u001b[0m\n\u001b[1;32m 104\u001b[0m \u001b[39mfor\u001b[39;00m result \u001b[39min\u001b[39;00m results:\n\u001b[1;32m 105\u001b[0m movie_info \u001b[39m=\u001b[39m cur\u001b[39m.\u001b[39mexecute(\u001b[39m\"\u001b[39m\u001b[39mSELECT X_SIZE, Y_SIZE, MOVIE_ASSET_ID, NAME, PROTEIN_IS_WHITE, SPHERICAL_ABERRATION FROM MOVIE_ASSETS WHERE FILENAME = ?\u001b[39m\u001b[39m\"\u001b[39m, (parameters[result[\u001b[39m\"\u001b[39m\u001b[39mparameter_index\u001b[39m\u001b[39m\"\u001b[39m]]\u001b[39m.\u001b[39minput_filename,))\u001b[39m.\u001b[39mfetchone()\n\u001b[0;32m--> 106\u001b[0m x_bin_factor \u001b[39m=\u001b[39m movie_info[\u001b[39m0\u001b[39;49m] \u001b[39m/\u001b[39;49m result[\u001b[39m\"\u001b[39;49m\u001b[39morig_x\u001b[39;49m\u001b[39m\"\u001b[39;49m]\n\u001b[1;32m 107\u001b[0m y_bin_factor \u001b[39m=\u001b[39m movie_info[\u001b[39m1\u001b[39m] \u001b[39m/\u001b[39m result[\u001b[39m\"\u001b[39m\u001b[39morig_y\u001b[39m\u001b[39m\"\u001b[39m]\n\u001b[1;32m 108\u001b[0m average_bin_factor \u001b[39m=\u001b[39m (x_bin_factor \u001b[39m+\u001b[39m y_bin_factor) \u001b[39m/\u001b[39m \u001b[39m2.0\u001b[39m\n", - "\u001b[0;31mZeroDivisionError\u001b[0m: division by zero" - ] - } - ], + "outputs": [], "source": [ - "unblur.write_results_to_database(database,pars,results)" + "pars, image_info = ctffind.parameters_from_database(database)" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "import dataclasses" + "pars" ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "new_pars = []\n", - "for i in [2,4,8]:\n", - " new_pars.append(dataclasses.replace(pars[0],\n", - " output_binning_factor=i,\n", - " output_filename=pars[0].output_filename[:-4]+str(i)+\".mrc\"))" + "ctffind_results = await ctffind.run_async(pars,num_procs=12)" ] }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "results = await unblur.run_async(new_pars,num_procs=12)" + "ctffind_results[1]" ] }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "ename": "ValueError", - "evalue": "Table 'MOVIE_ALIGNMENT_PARAMETERS_1' already exists.", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[18], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m unblur\u001b[39m.\u001b[39;49mwrite_results_to_database(database,new_pars,results)\n", - "File \u001b[0;32m~/pycistem/pycistem/programs/unblur.py:164\u001b[0m, in \u001b[0;36mwrite_results_to_database\u001b[0;34m(database, parameters, results)\u001b[0m\n\u001b[1;32m 162\u001b[0m conn\u001b[39m.\u001b[39mcommit()\n\u001b[1;32m 163\u001b[0m MOVIE_ALIGNMENT_PARAMETERS \u001b[39m=\u001b[39m pd\u001b[39m.\u001b[39mDataFrame(MOVIE_ALIGNMENT_PARAMETERS)\n\u001b[0;32m--> 164\u001b[0m MOVIE_ALIGNMENT_PARAMETERS\u001b[39m.\u001b[39;49mto_sql(\u001b[39mf\u001b[39;49m\u001b[39m\"\u001b[39;49m\u001b[39mMOVIE_ALIGNMENT_PARAMETERS_\u001b[39;49m\u001b[39m{\u001b[39;49;00mmax_alignment_id\u001b[39m+\u001b[39;49m\u001b[39m1\u001b[39;49m\u001b[39m}\u001b[39;49;00m\u001b[39m\"\u001b[39;49m, conn, if_exists\u001b[39m=\u001b[39;49m\u001b[39m\"\u001b[39;49m\u001b[39mfail\u001b[39;49m\u001b[39m\"\u001b[39;49m, index\u001b[39m=\u001b[39;49m\u001b[39mFalse\u001b[39;49;00m)\n\u001b[1;32m 165\u001b[0m max_alignment_id \u001b[39m+\u001b[39m\u001b[39m=\u001b[39m \u001b[39m1\u001b[39m\n\u001b[1;32m 166\u001b[0m MOVIE_ALIGNMENT_LIST \u001b[39m=\u001b[39m pd\u001b[39m.\u001b[39mDataFrame(MOVIE_ALIGNMENT_LIST)\n", - "File \u001b[0;32m~/.conda/envs/decolace/lib/python3.10/site-packages/pandas/core/generic.py:2878\u001b[0m, in \u001b[0;36mNDFrame.to_sql\u001b[0;34m(self, name, con, schema, if_exists, index, index_label, chunksize, dtype, method)\u001b[0m\n\u001b[1;32m 2713\u001b[0m \u001b[39m\u001b[39m\u001b[39m\"\"\"\u001b[39;00m\n\u001b[1;32m 2714\u001b[0m \u001b[39mWrite records stored in a DataFrame to a SQL database.\u001b[39;00m\n\u001b[1;32m 2715\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 2874\u001b[0m \u001b[39m[(1,), (None,), (2,)]\u001b[39;00m\n\u001b[1;32m 2875\u001b[0m \u001b[39m\"\"\"\u001b[39;00m \u001b[39m# noqa:E501\u001b[39;00m\n\u001b[1;32m 2876\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mpandas\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mio\u001b[39;00m \u001b[39mimport\u001b[39;00m sql\n\u001b[0;32m-> 2878\u001b[0m \u001b[39mreturn\u001b[39;00m sql\u001b[39m.\u001b[39;49mto_sql(\n\u001b[1;32m 2879\u001b[0m \u001b[39mself\u001b[39;49m,\n\u001b[1;32m 2880\u001b[0m name,\n\u001b[1;32m 2881\u001b[0m con,\n\u001b[1;32m 2882\u001b[0m schema\u001b[39m=\u001b[39;49mschema,\n\u001b[1;32m 2883\u001b[0m if_exists\u001b[39m=\u001b[39;49mif_exists,\n\u001b[1;32m 2884\u001b[0m index\u001b[39m=\u001b[39;49mindex,\n\u001b[1;32m 2885\u001b[0m index_label\u001b[39m=\u001b[39;49mindex_label,\n\u001b[1;32m 2886\u001b[0m chunksize\u001b[39m=\u001b[39;49mchunksize,\n\u001b[1;32m 2887\u001b[0m dtype\u001b[39m=\u001b[39;49mdtype,\n\u001b[1;32m 2888\u001b[0m method\u001b[39m=\u001b[39;49mmethod,\n\u001b[1;32m 2889\u001b[0m )\n", - "File \u001b[0;32m~/.conda/envs/decolace/lib/python3.10/site-packages/pandas/io/sql.py:767\u001b[0m, in \u001b[0;36mto_sql\u001b[0;34m(frame, name, con, schema, if_exists, index, index_label, chunksize, dtype, method, engine, **engine_kwargs)\u001b[0m\n\u001b[1;32m 762\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mNotImplementedError\u001b[39;00m(\n\u001b[1;32m 763\u001b[0m \u001b[39m\"\u001b[39m\u001b[39m'\u001b[39m\u001b[39mframe\u001b[39m\u001b[39m'\u001b[39m\u001b[39m argument should be either a Series or a DataFrame\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m 764\u001b[0m )\n\u001b[1;32m 766\u001b[0m \u001b[39mwith\u001b[39;00m pandasSQL_builder(con, schema\u001b[39m=\u001b[39mschema, need_transaction\u001b[39m=\u001b[39m\u001b[39mTrue\u001b[39;00m) \u001b[39mas\u001b[39;00m pandas_sql:\n\u001b[0;32m--> 767\u001b[0m \u001b[39mreturn\u001b[39;00m pandas_sql\u001b[39m.\u001b[39;49mto_sql(\n\u001b[1;32m 768\u001b[0m frame,\n\u001b[1;32m 769\u001b[0m name,\n\u001b[1;32m 770\u001b[0m if_exists\u001b[39m=\u001b[39;49mif_exists,\n\u001b[1;32m 771\u001b[0m index\u001b[39m=\u001b[39;49mindex,\n\u001b[1;32m 772\u001b[0m index_label\u001b[39m=\u001b[39;49mindex_label,\n\u001b[1;32m 773\u001b[0m schema\u001b[39m=\u001b[39;49mschema,\n\u001b[1;32m 774\u001b[0m chunksize\u001b[39m=\u001b[39;49mchunksize,\n\u001b[1;32m 775\u001b[0m dtype\u001b[39m=\u001b[39;49mdtype,\n\u001b[1;32m 776\u001b[0m method\u001b[39m=\u001b[39;49mmethod,\n\u001b[1;32m 777\u001b[0m engine\u001b[39m=\u001b[39;49mengine,\n\u001b[1;32m 778\u001b[0m \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mengine_kwargs,\n\u001b[1;32m 779\u001b[0m )\n", - "File \u001b[0;32m~/.conda/envs/decolace/lib/python3.10/site-packages/pandas/io/sql.py:2376\u001b[0m, in \u001b[0;36mSQLiteDatabase.to_sql\u001b[0;34m(self, frame, name, if_exists, index, index_label, schema, chunksize, dtype, method, engine, **engine_kwargs)\u001b[0m\n\u001b[1;32m 2365\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m{\u001b[39;00mcol\u001b[39m}\u001b[39;00m\u001b[39m (\u001b[39m\u001b[39m{\u001b[39;00mmy_type\u001b[39m}\u001b[39;00m\u001b[39m) not a string\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m 2367\u001b[0m table \u001b[39m=\u001b[39m SQLiteTable(\n\u001b[1;32m 2368\u001b[0m name,\n\u001b[1;32m 2369\u001b[0m \u001b[39mself\u001b[39m,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 2374\u001b[0m dtype\u001b[39m=\u001b[39mdtype,\n\u001b[1;32m 2375\u001b[0m )\n\u001b[0;32m-> 2376\u001b[0m table\u001b[39m.\u001b[39;49mcreate()\n\u001b[1;32m 2377\u001b[0m \u001b[39mreturn\u001b[39;00m table\u001b[39m.\u001b[39minsert(chunksize, method)\n", - "File \u001b[0;32m~/.conda/envs/decolace/lib/python3.10/site-packages/pandas/io/sql.py:903\u001b[0m, in \u001b[0;36mSQLTable.create\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 901\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mexists():\n\u001b[1;32m 902\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mif_exists \u001b[39m==\u001b[39m \u001b[39m\"\u001b[39m\u001b[39mfail\u001b[39m\u001b[39m\"\u001b[39m:\n\u001b[0;32m--> 903\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mTable \u001b[39m\u001b[39m'\u001b[39m\u001b[39m{\u001b[39;00m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mname\u001b[39m}\u001b[39;00m\u001b[39m'\u001b[39m\u001b[39m already exists.\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m 904\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mif_exists \u001b[39m==\u001b[39m \u001b[39m\"\u001b[39m\u001b[39mreplace\u001b[39m\u001b[39m\"\u001b[39m:\n\u001b[1;32m 905\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mpd_sql\u001b[39m.\u001b[39mdrop_table(\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mname, \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mschema)\n", - "\u001b[0;31mValueError\u001b[0m: Table 'MOVIE_ALIGNMENT_PARAMETERS_1' already exists." - ] - } - ], + "outputs": [], "source": [ - "unblur.write_results_to_database(database,new_pars,results)" + "ctffind.write_results_to_database(database,pars,ctffind_results,image_info)" ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[UnblurParameters(input_filename='/data/elferich/pycistem_test/s_records_15-10_00000_-20.0_Oct29_18.43.38.tif', output_filename='/nrs/elferich/Test20230706/Assets/Images/s_records_15-10_00000_-20.0_Oct29_18.43.38_1_auto_02.mrc', pixel_size=0.53, minimum_shift_in_angstroms=2.0, maximum_shift_in_angstroms=40.0, should_dose_filter=True, should_restore_power=True, termination_threshold_in_angstroms=1.0, max_iterations=10, bfactor_in_angstroms=1500, should_mask_central_cross=True, horizontal_mask_size=1, vertical_mask_size=1, acceleration_voltage=300.0, exposure_per_frame=0.8, pre_exposure_amount=0.0, movie_is_gain_corrected=False, gain_filename='/data/elferich/pycistem_test/SuperCDSRef_s_lamella_00000_-20.0_Oct29_12.16.03.dm4', movie_is_dark_corrected=True, dark_filename='dark.mrc', output_binning_factor=2, correct_mag_distortion=False, mag_distortion_angle=0.0, mag_distortion_major_scale=1.0, mag_distortion_minor_scale=1.0, write_out_amplitude_spectrum=True, amplitude_spectrum_filename='/nrs/elferich/Test20230706/Assets/Images/Spectra/s_records_15-10_00000_-20.0_Oct29_18.43.38_1_auto.mrc', write_out_small_sum_image=True, small_sum_image_filename='/nrs/elferich/Test20230706/Assets/Images/Scaled/s_records_15-10_00000_-20.0_Oct29_18.43.38_1_auto.mrc', first_frame=1, last_frame=0, number_of_frames_for_running_average=1, max_threads=1, save_aligned_frames=False, aligned_frames_filename='aligned_frames.mrc', output_shift_text_file='shifts.txt', eer_frames_per_image=0, eer_super_res_factor=1, align_on_cropped_area=False, cropped_area_center_x=0, cropped_area_center_y=0, cropped_area_size_x=-1, cropped_area_size_y=-1, replace_dark_areas_with_gaussian_noise=False, threshold_for_gaussian_noise=0.1, measure_mean_and_variance_for_gaussian_noise=False, mean_for_gaussian_noise=0.0, variance_for_gaussian_noise=0.0),\n", - " UnblurParameters(input_filename='/data/elferich/pycistem_test/s_records_15-10_00000_-20.0_Oct29_18.43.38.tif', output_filename='/nrs/elferich/Test20230706/Assets/Images/s_records_15-10_00000_-20.0_Oct29_18.43.38_1_auto_04.mrc', pixel_size=0.53, minimum_shift_in_angstroms=2.0, maximum_shift_in_angstroms=40.0, should_dose_filter=True, should_restore_power=True, termination_threshold_in_angstroms=1.0, max_iterations=10, bfactor_in_angstroms=1500, should_mask_central_cross=True, horizontal_mask_size=1, vertical_mask_size=1, acceleration_voltage=300.0, exposure_per_frame=0.8, pre_exposure_amount=0.0, movie_is_gain_corrected=False, gain_filename='/data/elferich/pycistem_test/SuperCDSRef_s_lamella_00000_-20.0_Oct29_12.16.03.dm4', movie_is_dark_corrected=True, dark_filename='dark.mrc', output_binning_factor=4, correct_mag_distortion=False, mag_distortion_angle=0.0, mag_distortion_major_scale=1.0, mag_distortion_minor_scale=1.0, write_out_amplitude_spectrum=True, amplitude_spectrum_filename='/nrs/elferich/Test20230706/Assets/Images/Spectra/s_records_15-10_00000_-20.0_Oct29_18.43.38_1_auto.mrc', write_out_small_sum_image=True, small_sum_image_filename='/nrs/elferich/Test20230706/Assets/Images/Scaled/s_records_15-10_00000_-20.0_Oct29_18.43.38_1_auto.mrc', first_frame=1, last_frame=0, number_of_frames_for_running_average=1, max_threads=1, save_aligned_frames=False, aligned_frames_filename='aligned_frames.mrc', output_shift_text_file='shifts.txt', eer_frames_per_image=0, eer_super_res_factor=1, align_on_cropped_area=False, cropped_area_center_x=0, cropped_area_center_y=0, cropped_area_size_x=-1, cropped_area_size_y=-1, replace_dark_areas_with_gaussian_noise=False, threshold_for_gaussian_noise=0.1, measure_mean_and_variance_for_gaussian_noise=False, mean_for_gaussian_noise=0.0, variance_for_gaussian_noise=0.0),\n", - " UnblurParameters(input_filename='/data/elferich/pycistem_test/s_records_15-10_00000_-20.0_Oct29_18.43.38.tif', output_filename='/nrs/elferich/Test20230706/Assets/Images/s_records_15-10_00000_-20.0_Oct29_18.43.38_1_auto_08.mrc', pixel_size=0.53, minimum_shift_in_angstroms=2.0, maximum_shift_in_angstroms=40.0, should_dose_filter=True, should_restore_power=True, termination_threshold_in_angstroms=1.0, max_iterations=10, bfactor_in_angstroms=1500, should_mask_central_cross=True, horizontal_mask_size=1, vertical_mask_size=1, acceleration_voltage=300.0, exposure_per_frame=0.8, pre_exposure_amount=0.0, movie_is_gain_corrected=False, gain_filename='/data/elferich/pycistem_test/SuperCDSRef_s_lamella_00000_-20.0_Oct29_12.16.03.dm4', movie_is_dark_corrected=True, dark_filename='dark.mrc', output_binning_factor=8, correct_mag_distortion=False, mag_distortion_angle=0.0, mag_distortion_major_scale=1.0, mag_distortion_minor_scale=1.0, write_out_amplitude_spectrum=True, amplitude_spectrum_filename='/nrs/elferich/Test20230706/Assets/Images/Spectra/s_records_15-10_00000_-20.0_Oct29_18.43.38_1_auto.mrc', write_out_small_sum_image=True, small_sum_image_filename='/nrs/elferich/Test20230706/Assets/Images/Scaled/s_records_15-10_00000_-20.0_Oct29_18.43.38_1_auto.mrc', first_frame=1, last_frame=0, number_of_frames_for_running_average=1, max_threads=1, save_aligned_frames=False, aligned_frames_filename='aligned_frames.mrc', output_shift_text_file='shifts.txt', eer_frames_per_image=0, eer_super_res_factor=1, align_on_cropped_area=False, cropped_area_center_x=0, cropped_area_center_y=0, cropped_area_size_x=-1, cropped_area_size_y=-1, replace_dark_areas_with_gaussian_noise=False, threshold_for_gaussian_noise=0.1, measure_mean_and_variance_for_gaussian_noise=False, mean_for_gaussian_noise=0.0, variance_for_gaussian_noise=0.0)]" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "new_pars" - ] + "outputs": [], + "source": [] }, { "cell_type": "code", @@ -2257,7 +176,7 @@ ], "metadata": { "kernelspec": { - "display_name": "decolace", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -2272,9 +191,8 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.11" - }, - "orig_nbformat": 4 + } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/examples/test_matchtemplate.py b/examples/test_matchtemplate.py index e942897..8fb5001 100644 --- a/examples/test_matchtemplate.py +++ b/examples/test_matchtemplate.py @@ -6,6 +6,7 @@ import logging from rich.logging import RichHandler from rich import print +import starfile logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) diff --git a/hatch_build.py b/hatch_build.py index 6df8f45..88264fc 100644 --- a/hatch_build.py +++ b/hatch_build.py @@ -14,6 +14,7 @@ # Overwrite default compiler flags. It's kind of a hack to add the import flgs to the compiler string, but I think its the only way. class custom_build_ext(build_ext): def build_extensions(self): + print("Building extensions") # Override the compiler executables. Importantly, this # removes the "default" compiler flags that would # otherwise get passed on to to the compiler, i.e., @@ -68,7 +69,7 @@ def build(setup_kwargs: dict[str, Any]) -> None: ], # Example: passing in the version to the compiled code define_macros = [("VERSION_INFO", __version__)], - include_dirs=["cisTEM/src/"], + include_dirs=["cisTEM/src/","cisTEM/build/gcc"], extra_objects = [ "cisTEM/build/gcc/src/libcore.a"], extra_link_args = link_args, ), @@ -83,7 +84,9 @@ def build(setup_kwargs: dict[str, Any]) -> None: class CustomBuildHook(BuildHookInterface): def initialize(self, version, build_data): - + print(version) + if version == "editable": + return t = {"packages": ["pycistem"]} build(t) d = setup(**t,script_args=["build_ext"]) diff --git a/pycistem/database/__init__.py b/pycistem/database/__init__.py index 36909ae..b87036c 100644 --- a/pycistem/database/__init__.py +++ b/pycistem/database/__init__.py @@ -2,7 +2,7 @@ import sqlite3 from pathlib import Path from selectors import EpollSelector -from pycistem.core import Project +#from pycistem.core import Project from datetime import datetime import mrcfile @@ -15,6 +15,7 @@ def create_project( project_name: str, output_dir: Path): + from pycistem.core import Project Path(output_dir, project_name).mkdir(parents=True, exist_ok=True) project = Project() success = project.CreateNewProject( @@ -25,6 +26,7 @@ def create_project( return Path(output_dir, project_name, f"{project_name}.db") def import_movies(project_path: Union[str, Path], movies: Union[str, Path, List[Union[str, Path]]], pixelsize: float, exposure_dose: float, pattern="*.tif", gain: Union[bool, str, Path] = True, import_metadata: bool = True, bin_to_pixelsize: float = 1.0): + from pycistem.core import Project if isinstance(project_path, Path): project_path = project_path.as_posix() project = Project() diff --git a/pycistem/programs/apply_ctf.py b/pycistem/programs/apply_ctf.py index 0c58619..5abf9e8 100644 --- a/pycistem/programs/apply_ctf.py +++ b/pycistem/programs/apply_ctf.py @@ -49,3 +49,11 @@ def run(parameters: Union[ApplyCtfParameters,list[ApplyCtfParameters]],**kwargs) asyncio.run(cistem_program.run("applyctf",parameters,**kwargs)) + +async def run_async(parameters: Union[ApplyCtfParameters,list[ApplyCtfParameters]],**kwargs): + if not isinstance(parameters, list): + parameters = [parameters] + + + await cistem_program.run("applyctf",parameters,**kwargs) + diff --git a/pycistem/programs/cistem_program.py b/pycistem/programs/cistem_program.py index 5aa2d2f..9adde59 100644 --- a/pycistem/programs/cistem_program.py +++ b/pycistem/programs/cistem_program.py @@ -112,7 +112,7 @@ async def handle_leader(reader, writer, buffers, signal_handlers,results): cont = True while cont: data = await reader.readexactly(16) - log.debug(f"In no sig {addr} sent {data}") + # log.debug(f"In no sig {addr} sent {data}") result = None if data != socket_job_result_queue and data != socket_i_have_info: cont = False @@ -134,7 +134,7 @@ async def handle_leader(reader, writer, buffers, signal_handlers,results): while cont: if socket_send_next_job not in signal_handlers: data = await reader.readexactly(16) - log.debug(f"In cont {addr} sent {data}") + # log.debug(f"In cont {addr} sent {data}") if data != socket_send_next_job: if data == socket_job_result_queue: res = await signal_handlers[data](reader,writer,log) @@ -237,26 +237,41 @@ async def run(executable: str,parameters,signal_handlers={},num_procs=1,num_thre launch_futures.append(await asyncio.create_subprocess_shell( task, stdout=asyncio.subprocess.PIPE, - stderr=asyncio.subprocess.PIPE)) + stderr=asyncio.subprocess.STDOUT)) sleep(sleep_time) logging.debug(f"Launched {num_procs} processes") + + #if save_output: + # while True: + # for i, future in enumerate(launch_futures): + # line = await future.stdout.readline() + # if line: + # print(f"Pro {i}:") + # print(line) + + result_futures = [ future.communicate() for future in launch_futures ] + + try: proc_results = await asyncio.gather(*result_futures, return_exceptions=False) except Exception as ex: print("Caught error executing task", ex) raise - if save_output: - for i, result in enumerate(proc_results): - with open(save_output_path + f"_{i}.txt", "w") as f: - f.write(result[0].decode("utf-8")) - if len(result[1]) > 0: - with open(save_output_path + f"_{i}_error.txt", "w") as f: - f.write(result[1].decode("utf-8")) + finally: + if save_output: + for i, result in enumerate(proc_results): + with open(save_output_path + f"_{i}.txt", "w") as f: + f.write(result[0].decode("utf-8")) + if result[1] and len(result[1]) > 0: + with open(save_output_path + f"_{i}_error.txt", "w") as f: + f.write(result[1].decode("utf-8")) + server_leader.close() + server_manager.close() return(results) diff --git a/pycistem/programs/ctffind.py b/pycistem/programs/ctffind.py index 4ec630f..ec04c57 100644 --- a/pycistem/programs/ctffind.py +++ b/pycistem/programs/ctffind.py @@ -56,6 +56,7 @@ class CtffindParameters: desired_number_of_threads: int = 1 eer_frames_per_image: int = 0 eer_super_res_factor: int = 1 + filter_lowres_signal: bool = True fit_nodes: bool = False fit_nodes_1D_brute_force: bool = True fit_nodes_2D_refine: bool = True @@ -73,7 +74,7 @@ def parameters_from_database(database, decolace=False, **kwargs): pixel_size_of_input_image = image["movie_pixel_size"], gain_filename=image["GAIN_FILENAME"], output_diagnostic_filename=(ProjectDirectory / "Assets" / "CTF" / f"{Path(image['FILENAME']).stem}_{image['MOVIE_ASSET_ID']}_auto.mrc").as_posix(), - fit_nodes=True + fit_nodes=decolace ) for i,image in image_info.iterrows()] return((par, image_info)) @@ -163,9 +164,11 @@ def write_results_to_database(database, parameters: list[CtffindParameters], re async def handle_results(reader, writer, logger): #logger.info("Handling results") await reader.read(4) - length = await reader.read(4) + length = await reader.readexactly(4) + print(f"CTFFIND results length {length}") number_of_bytes = int.from_bytes(length, byteorder="little") - results = await reader.read(number_of_bytes*4) + results = await reader.readexactly(number_of_bytes*4) + print(f"CTFFIND results {results}") return(results) signal_handlers = { diff --git a/pycistem/programs/estimate_beamtilt.py b/pycistem/programs/estimate_beamtilt.py index f816e90..abe95d1 100644 --- a/pycistem/programs/estimate_beamtilt.py +++ b/pycistem/programs/estimate_beamtilt.py @@ -10,7 +10,7 @@ from pycistem.programs import cistem_program from pycistem.programs._cistem_constants import socket_send_next_job, socket_job_result_queue -from pycistem.core import Image +#from pycistem.core import Image @dataclass class EstimateBeamtiltParameters: diff --git a/pycistem/programs/match_template.py b/pycistem/programs/match_template.py index bca4c88..c4ce618 100644 --- a/pycistem/programs/match_template.py +++ b/pycistem/programs/match_template.py @@ -15,7 +15,7 @@ from pycistem.core import EulerSearch, ParameterMap from pycistem.database import datetime_to_msdos, ensure_template_is_a_volume_asset, get_image_info_from_db, create_peak_lists, get_max_match_template_job_id from pycistem.programs import cistem_program -from pycistem.programs._cistem_constants import socket_job_result_queue, socket_program_defined_result +from pycistem.programs._cistem_constants import socket_job_result_queue, socket_program_defined_result, socket_i_have_info @dataclass @@ -67,6 +67,11 @@ class MatchTemplateParameters: # 1. Write correct threshold into db # 2. Get correct border_exclude value # 3. Maybe do projection? +async def handle_socket_i_have_info(reader, writer, logger): + data = await reader.readexactly(4) + length = int.from_bytes(data, byteorder="little") + data = await reader.readexactly(length) + print(f"Info: {data.decode('utf-8')}") def get_np_arrays(bytes,o,i,x,y,numpix): array = np.frombuffer(bytes,offset=o+i*numpix*4, count=numpix,dtype=np.float32).copy() @@ -74,7 +79,7 @@ def get_np_arrays(bytes,o,i,x,y,numpix): array = array[:,:x] return array -def parameters_from_database(database, template_filename: str, match_template_job_id: Optional[int] = None,**kwargs): +def parameters_from_database(database, template_filename: str, match_template_job_id: Optional[int] = None,**kwargs) : image_info = get_image_info_from_db(database,get_ctf=True) if image_info is None: return [] @@ -201,23 +206,27 @@ async def handle_results(reader, writer, logger, parameters, write_directly_to_d x_dim = int(struct.unpack("