pycistem 0.6.1__cp310-cp310-manylinux_2_28_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. pycistem/__init__.py +9 -0
  2. pycistem/config.py +20 -0
  3. pycistem/core/__init__.py +1 -0
  4. pycistem/core/core.cpp +1070 -0
  5. pycistem/core/core.cpython-310-x86_64-linux-gnu.so +0 -0
  6. pycistem/core/database.cpp +408 -0
  7. pycistem/core/euler_search.cpp +72 -0
  8. pycistem/core/run_profiles.cpp +114 -0
  9. pycistem/database/__init__.py +301 -0
  10. pycistem/programs/__init__.py +10 -0
  11. pycistem/programs/_cistem_constants.py +23 -0
  12. pycistem/programs/apply_ctf.py +59 -0
  13. pycistem/programs/cistem_program.py +277 -0
  14. pycistem/programs/ctffind.py +254 -0
  15. pycistem/programs/estimate_beamtilt.py +60 -0
  16. pycistem/programs/match_template.py +325 -0
  17. pycistem/programs/reconstruct3d.py +79 -0
  18. pycistem/programs/refine_ctf.py +106 -0
  19. pycistem/programs/refine_template.py +157 -0
  20. pycistem/programs/refine_template_dev.py +35 -0
  21. pycistem/programs/refine_template_niko.py +124 -0
  22. pycistem/programs/resample.py +30 -0
  23. pycistem/programs/run_profile.py +17 -0
  24. pycistem/programs/unblur.py +247 -0
  25. pycistem/programs/unblur_patch.py +204 -0
  26. pycistem/utils/__init__.py +1 -0
  27. pycistem/utils/extract_particles.py +36 -0
  28. pycistem/utils/move_class_into_unbinned_particle_stack.py +34 -0
  29. pycistem/utils/order_by_class_occupancy.py +26 -0
  30. pycistem/utils/plot_class_occupancy.py +51 -0
  31. pycistem/utils/plot_classification_fsc_movie.py +90 -0
  32. pycistem/utils/plot_occupancy_by_condition.py +129 -0
  33. pycistem-0.6.1.dist-info/METADATA +258 -0
  34. pycistem-0.6.1.dist-info/RECORD +84 -0
  35. pycistem-0.6.1.dist-info/WHEEL +5 -0
  36. pycistem-0.6.1.dist-info/licenses/LICENSE +201 -0
  37. pycistem-0.6.1.dist-info/sboms/auditwheel.cdx.json +1 -0
  38. pycistem.libs/libXau-154567c4.so.6.0.0 +0 -0
  39. pycistem.libs/libXcomposite-9a78b2b5.so.1.0.0 +0 -0
  40. pycistem.libs/libXcursor-557eab0f.so.1.0.2 +0 -0
  41. pycistem.libs/libXdamage-45f20f14.so.1.1.0 +0 -0
  42. pycistem.libs/libXfixes-e3b7d94c.so.3.1.0 +0 -0
  43. pycistem.libs/libXi-9178a6bd.so.6.1.0 +0 -0
  44. pycistem.libs/libXinerama-6a3f4a3e.so.1.0.0 +0 -0
  45. pycistem.libs/libXrandr-9f75043e.so.2.2.0 +0 -0
  46. pycistem.libs/libatk-1-3e086f29.0.so.0.22810.1 +0 -0
  47. pycistem.libs/libblkid-a9167753.so.1.1.0 +0 -0
  48. pycistem.libs/libbz2-a1e77c99.so.1.0.6 +0 -0
  49. pycistem.libs/libcairo-dfbea965.so.2.11512.0 +0 -0
  50. pycistem.libs/libdatrie-584ecbbd.so.1.3.2 +0 -0
  51. pycistem.libs/libffi-3a37023a.so.6.0.2 +0 -0
  52. pycistem.libs/libfontconfig-dcb2ce6c.so.1.12.0 +0 -0
  53. pycistem.libs/libfreetype-2f3b32b6.so.6.16.1 +0 -0
  54. pycistem.libs/libfribidi-a2ddad26.so.0.4.0 +0 -0
  55. pycistem.libs/libgdk-x11-2-ae2f4865.0.so.0.2400.32 +0 -0
  56. pycistem.libs/libgdk_pixbuf-2-e875edac.0.so.0.3612.0 +0 -0
  57. pycistem.libs/libgio-2-54f4f0a9.0.so.0.5600.4 +0 -0
  58. pycistem.libs/libgmodule-2-a8eef785.0.so.0.5600.4 +0 -0
  59. pycistem.libs/libgmp-d944b113.so.10.3.2 +0 -0
  60. pycistem.libs/libgnutls-e5fc1c5f.so.30.28.2 +0 -0
  61. pycistem.libs/libgomp-e985bcbb.so.1.0.0 +0 -0
  62. pycistem.libs/libgraphite2-a2b39163.so.3.0.1 +0 -0
  63. pycistem.libs/libgtk-x11-2-76f42ab1.0.so.0.2400.32 +0 -0
  64. pycistem.libs/libharfbuzz-26b3d829.so.0.10705.0 +0 -0
  65. pycistem.libs/libhogweed-cd4c53be.so.4.5 +0 -0
  66. pycistem.libs/libidn2-2f4a5893.so.0.3.6 +0 -0
  67. pycistem.libs/libmount-ec61bd71.so.1.1.0 +0 -0
  68. pycistem.libs/libnettle-37944285.so.6.5 +0 -0
  69. pycistem.libs/libp11-kit-ac9dcd7e.so.0.3.0 +0 -0
  70. pycistem.libs/libpango-1-e80d1584.0.so.0.4200.3 +0 -0
  71. pycistem.libs/libpangocairo-1-e0e0fbcf.0.so.0.4200.3 +0 -0
  72. pycistem.libs/libpangoft2-1-1fa1613e.0.so.0.4200.3 +0 -0
  73. pycistem.libs/libpcre-0dd207b5.so.1.2.10 +0 -0
  74. pycistem.libs/libpcre2-8-516f4c9d.so.0.7.1 +0 -0
  75. pycistem.libs/libpixman-1-06469c37.so.0.38.4 +0 -0
  76. pycistem.libs/libpng16-748299c7.so.16.34.0 +0 -0
  77. pycistem.libs/libselinux-d0805dcb.so.1 +0 -0
  78. pycistem.libs/libtasn1-564de53e.so.6.5.5 +0 -0
  79. pycistem.libs/libthai-cd935638.so.0.3.0 +0 -0
  80. pycistem.libs/libunistring-05abdd40.so.2.1.0 +0 -0
  81. pycistem.libs/libuuid-95b83d40.so.1.3.0 +0 -0
  82. pycistem.libs/libxcb-5ddf6756.so.1.1.0 +0 -0
  83. pycistem.libs/libxcb-render-161c0eb5.so.0.0.0 +0 -0
  84. pycistem.libs/libxcb-shm-0be6dfbf.so.0.0.0 +0 -0
@@ -0,0 +1,408 @@
1
+ #include <pybind11/pybind11.h>
2
+ #include <pybind11/numpy.h>
3
+ #include "core/core_headers.h"
4
+
5
+
6
+
7
+ #define STRINGIFY(x) #x
8
+ #define MACRO_STRINGIFY(x) STRINGIFY(x)
9
+
10
+ namespace py = pybind11;
11
+
12
+ namespace PYBIND11_NAMESPACE { namespace detail {
13
+ template <> struct type_caster<wxString> {
14
+ public:
15
+ /**
16
+ * This macro establishes the name 'inty' in
17
+ * function signatures and declares a local variable
18
+ * 'value' of type inty
19
+ */
20
+ PYBIND11_TYPE_CASTER(wxString, const_name("wxString"));
21
+
22
+ /**
23
+ * Conversion part 1 (Python->C++): convert a PyObject into a inty
24
+ * instance or return false upon failure. The second argument
25
+ * indicates whether implicit conversions should be applied.
26
+ */
27
+ bool load(handle src, bool) {
28
+ /* Extract PyObject from handle */
29
+ PyObject *source = src.ptr();
30
+ /* Try converting into a Python string */
31
+ PyObject *tmp = PyObject_Str(source);
32
+ if (!tmp)
33
+ return false;
34
+ /* Now try to convert into a wxString */
35
+ value.Append(PyUnicode_AsUTF8(tmp));
36
+ Py_DECREF(tmp);
37
+ /* Ensure return code was OK (to avoid out-of-range errors etc) */
38
+ return !PyErr_Occurred();
39
+ }
40
+
41
+ /**
42
+ * Conversion part 2 (C++ -> Python): convert an inty instance into
43
+ * a Python object. The second and third arguments are used to
44
+ * indicate the return value policy and parent object (for
45
+ * ``return_value_policy::reference_internal``) and are generally
46
+ * ignored by implicit casters.
47
+ */
48
+ static handle cast(wxString src, return_value_policy /* policy */, handle /* parent */) {
49
+ return py::str(src.ToStdString());
50
+ }
51
+ };
52
+ }} // namespace PYBIND11_NAMESPACE::detail
53
+
54
+ void init_database(py::module &m) {
55
+
56
+ py::class_<Database> database(m, "Database");
57
+ database
58
+ .def(py::init<>())
59
+ .def("Close", &Database::Close)
60
+ .def("ReturnFilename", &Database::ReturnFilename)
61
+ .def("CreateNewDatabase", &Database::CreateNewDatabase)
62
+ .def("Open", &Database::Open)
63
+ .def("Begin", &Database::Begin)
64
+ .def("Commit", &Database::Commit)
65
+ //.def("CreateTable", &Database::CreateTable)
66
+ .def("DeleteTable", &Database::DeleteTable)
67
+ .def("AddColumnToTable", &Database::AddColumnToTable)
68
+ //.def("InsertOrReplace", &Database::InsertOrReplace)
69
+ .def("GetMasterSettings", [](Database &__inst)
70
+ {
71
+ wxFileName project_directory;
72
+ wxString project_name;
73
+ int imported_integer_version;
74
+ double total_cpu_hours;
75
+ int total_jobs_run;
76
+ wxString cistem_version_text;
77
+ cistem::workflow::Enum workflow;
78
+ auto __ret = __inst.GetMasterSettings(project_directory, project_name, imported_integer_version, total_cpu_hours, total_jobs_run, cistem_version_text, workflow);
79
+ return std::make_tuple(__ret, project_directory, project_name, imported_integer_version, total_cpu_hours, total_jobs_run, cistem_version_text, workflow);
80
+ })
81
+ .def("SetProjectStatistics", [](Database &__inst)
82
+ {
83
+ double total_cpu_hours;
84
+ int total_jobs_run;
85
+ auto __ret = __inst.SetProjectStatistics(total_cpu_hours, total_jobs_run);
86
+ return std::make_tuple(__ret, total_cpu_hours, total_jobs_run);
87
+ })
88
+ .def("CreateAllTables", &Database::CreateAllTables)
89
+ //.def("BeginBatchInsert", &Database::BeginBatchInsert)
90
+ //.def("AddToBatchInsert", &Database::AddToBatchInsert)
91
+ //.def("EndBatchInsert", &Database::EndBatchInsert)
92
+ //.def("BeginBatchSelect", &Database::BeginBatchSelect)
93
+ //.def("GetFromBatchSelect", &Database::GetFromBatchSelect)
94
+ //.def("EndBatchSelect", &Database::EndBatchSelect)
95
+ .def("ExecuteSQL", &Database::ExecuteSQL)
96
+ //.def("Prepare", &Database::Prepare)
97
+ //.def("Step", &Database::Step)
98
+ //.def("Finalize", &Database::Finalize)
99
+ .def("CheckBindCode", &Database::CheckBindCode)
100
+ .def("ReturnSingleIntFromSelectCommand", &Database::ReturnSingleIntFromSelectCommand)
101
+ .def("ReturnSingleLongFromSelectCommand", &Database::ReturnSingleLongFromSelectCommand)
102
+ .def("ReturnSingleDoubleFromSelectCommand", &Database::ReturnSingleDoubleFromSelectCommand)
103
+ //.def("ReturnIntArrayFromSelectCommand", &Database::ReturnIntArrayFromSelectCommand)
104
+ //.def("ReturnLongArrayFromSelectCommand", &Database::ReturnLongArrayFromSelectCommand)
105
+ //.def("ReturnStringArrayFromSelectCommand", &Database::ReturnStringArrayFromSelectCommand)
106
+ .def("DoesTableExist", &Database::DoesTableExist)
107
+ .def("DoesColumnExist", &Database::DoesColumnExist)
108
+ .def("ReturnProcessLockInfo", [](Database &__inst)
109
+ {
110
+ long active_process_id;
111
+ wxString active_hostname;
112
+ __inst.ReturnProcessLockInfo(active_process_id, active_hostname);
113
+ return std::make_tuple(active_process_id, active_hostname);
114
+ })
115
+ .def("SetProcessLockInfo", [](Database &__inst)
116
+ {
117
+ long active_process_id;
118
+ wxString active_hostname;
119
+ __inst.SetProcessLockInfo(active_process_id, active_hostname);
120
+ return std::make_tuple(active_process_id, active_hostname);
121
+ })
122
+ .def("ReturnRefinementIDGivenReconstructionID", &Database::ReturnRefinementIDGivenReconstructionID)
123
+ .def("ReturnHighestRefinementID", &Database::ReturnHighestRefinementID)
124
+ .def("ReturnHighestStartupID", &Database::ReturnHighestStartupID)
125
+ .def("ReturnHighestReconstructionID", &Database::ReturnHighestReconstructionID)
126
+ .def("ReturnHighestClassificationID", &Database::ReturnHighestClassificationID)
127
+ .def("ReturnHighestAlignmentID", &Database::ReturnHighestAlignmentID)
128
+ .def("ReturnHighestAlignmentJobID", &Database::ReturnHighestAlignmentJobID)
129
+ .def("ReturnHighestFindCTFID", &Database::ReturnHighestFindCTFID)
130
+ .def("ReturnHighestFindCTFJobID", &Database::ReturnHighestFindCTFJobID)
131
+ .def("ReturnHighestPickingID", &Database::ReturnHighestPickingID)
132
+ .def("ReturnHighestPickingJobID", &Database::ReturnHighestPickingJobID)
133
+ .def("ReturnHighestParticlePositionID", &Database::ReturnHighestParticlePositionID)
134
+ .def("ReturnHighestClassumSelectionID", &Database::ReturnHighestClassumSelectionID)
135
+ .def("ReturnHighestTemplateMatchID", &Database::ReturnHighestTemplateMatchID)
136
+ .def("ReturnHighestTemplateMatchJobID", &Database::ReturnHighestTemplateMatchJobID)
137
+ .def("SetActiveTemplateMatchJobForGivenImageAssetID", &Database::SetActiveTemplateMatchJobForGivenImageAssetID)
138
+ .def("ReturnNumberOfPreviousMovieAlignmentsByAssetID", &Database::ReturnNumberOfPreviousMovieAlignmentsByAssetID)
139
+ .def("ReturnNumberOfPreviousTemplateMatchesByAssetID", &Database::ReturnNumberOfPreviousTemplateMatchesByAssetID)
140
+ .def("ReturnNumberOfPreviousCTFEstimationsByAssetID", &Database::ReturnNumberOfPreviousCTFEstimationsByAssetID)
141
+ .def("ReturnNumberOfPreviousParticlePicksByAssetID", &Database::ReturnNumberOfPreviousParticlePicksByAssetID)
142
+ .def("ReturnNumberOfAlignmentJobs", &Database::ReturnNumberOfAlignmentJobs)
143
+ .def("ReturnNumberOfCTFEstimationJobs", &Database::ReturnNumberOfCTFEstimationJobs)
144
+ .def("ReturnNumberOfTemplateMatchingJobs", &Database::ReturnNumberOfTemplateMatchingJobs)
145
+ .def("ReturnNumberOfPickingJobs", &Database::ReturnNumberOfPickingJobs)
146
+ .def("ReturnNumberOfImageAssetsWithCTFEstimates", &Database::ReturnNumberOfImageAssetsWithCTFEstimates)
147
+ .def("GetUniqueAlignmentIDs", &Database::GetUniqueAlignmentIDs)
148
+ .def("GetUniqueCTFEstimationIDs", &Database::GetUniqueCTFEstimationIDs)
149
+ .def("GetUniqueTemplateMatchIDs", &Database::GetUniqueTemplateMatchIDs)
150
+ .def("GetUniquePickingJobIDs", &Database::GetUniquePickingJobIDs)
151
+ .def("GetUniqueIDsOfImagesWithCTFEstimations", [](Database &__inst, int *image_ids)
152
+ {
153
+ int number_of_image_ids;
154
+ __inst.GetUniqueIDsOfImagesWithCTFEstimations(image_ids, number_of_image_ids);
155
+ return number_of_image_ids;
156
+ })
157
+ .def("GetMovieImportDefaults", [](Database &__inst, wxString dark_reference_filename)
158
+ {
159
+ float voltage;
160
+ float spherical_aberration;
161
+ float pixel_size;
162
+ float exposure_per_frame;
163
+ bool movies_are_gain_corrected;
164
+ wxString gain_reference_filename;
165
+ bool movies_are_dark_corrected;
166
+ bool resample_movies;
167
+ float desired_pixel_size;
168
+ bool correct_mag_distortion;
169
+ float mag_distortion_angle;
170
+ float mag_distortion_major_scale;
171
+ float mag_distortion_minor_scale;
172
+ bool protein_is_white;
173
+ int eer_super_res_factor;
174
+ int eer_frames_per_image;
175
+ __inst.GetMovieImportDefaults(voltage, spherical_aberration, pixel_size, exposure_per_frame, movies_are_gain_corrected, gain_reference_filename, movies_are_dark_corrected, dark_reference_filename, resample_movies, desired_pixel_size, correct_mag_distortion, mag_distortion_angle, mag_distortion_major_scale, mag_distortion_minor_scale, protein_is_white, eer_super_res_factor, eer_frames_per_image);
176
+ return std::make_tuple(voltage, spherical_aberration, pixel_size, exposure_per_frame, movies_are_gain_corrected, gain_reference_filename, movies_are_dark_corrected, resample_movies, desired_pixel_size, correct_mag_distortion, mag_distortion_angle, mag_distortion_major_scale, mag_distortion_minor_scale, protein_is_white, eer_super_res_factor, eer_frames_per_image);
177
+ })
178
+ .def("GetImageImportDefaults", [](Database &__inst)
179
+ {
180
+ float voltage;
181
+ float spherical_aberration;
182
+ float pixel_size;
183
+ bool protein_is_white;
184
+ __inst.GetImageImportDefaults(voltage, spherical_aberration, pixel_size, protein_is_white);
185
+ return std::make_tuple(voltage, spherical_aberration, pixel_size, protein_is_white);
186
+ })
187
+ .def("GetActiveDefocusValuesByImageID", [](Database &__inst, long wanted_image_id)
188
+ {
189
+ float defocus_1;
190
+ float defocus_2;
191
+ float defocus_angle;
192
+ float phase_shift;
193
+ float amplitude_contrast;
194
+ float tilt_angle;
195
+ float tilt_axis;
196
+ __inst.GetActiveDefocusValuesByImageID(wanted_image_id, defocus_1, defocus_2, defocus_angle, phase_shift, amplitude_contrast, tilt_angle, tilt_axis);
197
+ return std::make_tuple(defocus_1, defocus_2, defocus_angle, phase_shift, amplitude_contrast, tilt_angle, tilt_axis);
198
+ })
199
+ .def("AddRefinementPackageAsset", &Database::AddRefinementPackageAsset)
200
+ //.def("Return2DClassMembers", &Database::Return2DClassMembers)
201
+ .def("ReturnNumberOf2DClassMembers", &Database::ReturnNumberOf2DClassMembers)
202
+ .def("AddOrReplaceRunProfile", &Database::AddOrReplaceRunProfile)
203
+ .def("DeleteRunProfile", &Database::DeleteRunProfile)
204
+ .def("BeginMovieAssetInsert", &Database::BeginMovieAssetInsert)
205
+ .def("AddNextMovieAsset", [](Database &__inst, int movie_asset_id, std::string name, std::string filename, int position_in_stack, int x_size, int y_size, int number_of_frames, double voltage, double pixel_size, double dose_per_frame, double spherical_aberration, std::string gain_filename, std::string dark_reference, double output_binning_factor, int correct_mag_distortion, float mag_distortion_angle, float mag_distortion_major_scale, float mag_distortion_minor_scale, int protein_is_white, int eer_super_res_factor, int eer_frames_per_imag)
206
+ { return __inst.AddNextMovieAsset(movie_asset_id, name, filename, position_in_stack, x_size, y_size, number_of_frames, voltage, pixel_size, dose_per_frame, spherical_aberration, gain_filename, dark_reference, output_binning_factor, correct_mag_distortion, mag_distortion_angle, mag_distortion_major_scale, mag_distortion_minor_scale, protein_is_white, eer_super_res_factor, eer_frames_per_imag); })
207
+ .def("EndMovieAssetInsert", &Database::EndMovieAssetInsert)
208
+ .def("UpdateNumberOfFramesForAMovieAsset", &Database::UpdateNumberOfFramesForAMovieAsset)
209
+ .def("BeginImageAssetInsert", &Database::BeginImageAssetInsert)
210
+ .def("AddNextImageAsset", &Database::AddNextImageAsset)
211
+ .def("EndImageAssetInsert", &Database::EndImageAssetInsert)
212
+ .def("BeginVolumeAssetInsert", &Database::BeginVolumeAssetInsert)
213
+ .def("AddNextVolumeAsset", &Database::AddNextVolumeAsset)
214
+ .def("EndVolumeAssetInsert", &Database::EndVolumeAssetInsert)
215
+ .def("BeginParticlePositionAssetInsert", &Database::BeginParticlePositionAssetInsert)
216
+ .def("AddNextParticlePositionAsset", &Database::AddNextParticlePositionAsset)
217
+ .def("EndParticlePositionAssetInsert", &Database::EndParticlePositionAssetInsert)
218
+ .def("CreateProcessLockTable", &Database::CreateProcessLockTable)
219
+ .def("CreateParticlePickingResultsTable", [](Database &__inst)
220
+ {
221
+ int picking_job_id;
222
+ auto __ret = __inst.CreateParticlePickingResultsTable(picking_job_id);
223
+ return std::make_tuple(__ret, picking_job_id);
224
+ })
225
+ .def("CreateRefinementPackageContainedParticlesTable", &Database::CreateRefinementPackageContainedParticlesTable)
226
+ .def("CreateRefinementPackageCurrent3DReferencesTable", &Database::CreateRefinementPackageCurrent3DReferencesTable)
227
+ .def("CreateRefinementPackageRefinementsList", &Database::CreateRefinementPackageRefinementsList)
228
+ .def("CreateRefinementPackageClassificationsList", &Database::CreateRefinementPackageClassificationsList)
229
+ .def("CreateRefinementDetailsTable", &Database::CreateRefinementDetailsTable)
230
+ .def("CreateTemplateMatchPeakListTable", &Database::CreateTemplateMatchPeakListTable)
231
+ .def("CreateTemplateMatchPeakChangeListTable", &Database::CreateTemplateMatchPeakChangeListTable)
232
+ .def("CreateRefinementResultTable", &Database::CreateRefinementResultTable)
233
+ .def("CreateRefinementResolutionStatisticsTable", &Database::CreateRefinementResolutionStatisticsTable)
234
+ .def("CreateRefinementAngularDistributionTable", &Database::CreateRefinementAngularDistributionTable)
235
+ .def("CreateClassificationResultTable", &Database::CreateClassificationResultTable)
236
+ .def("CreateClassificationSelectionTable", &Database::CreateClassificationSelectionTable)
237
+ .def("CreateMovieImportDefaultsTable", &Database::CreateMovieImportDefaultsTable)
238
+ .def("CreateImageImportDefaultsTable", &Database::CreateImageImportDefaultsTable)
239
+ .def("CreateStartupResultTable", &Database::CreateStartupResultTable)
240
+ .def("DoVacuum", &Database::DoVacuum)
241
+ .def("BeginAllMovieAssetsSelect", &Database::BeginAllMovieAssetsSelect)
242
+ .def("GetNextMovieAsset", &Database::GetNextMovieAsset)
243
+ .def("EndAllMovieAssetsSelect", &Database::EndAllMovieAssetsSelect)
244
+ .def("BeginAllMovieGroupsSelect", &Database::BeginAllMovieGroupsSelect)
245
+ .def("GetNextMovieGroup", &Database::GetNextMovieGroup)
246
+ .def("EndAllMovieGroupsSelect", &Database::EndAllMovieGroupsSelect)
247
+ .def("BeginAllImageAssetsSelect", &Database::BeginAllImageAssetsSelect)
248
+ .def("GetNextImageAsset", &Database::GetNextImageAsset)
249
+ .def("EndAllImageAssetsSelect", &Database::EndAllImageAssetsSelect)
250
+ .def("BeginAllImageGroupsSelect", &Database::BeginAllImageGroupsSelect)
251
+ .def("GetNextImageGroup", &Database::GetNextImageGroup)
252
+ .def("EndAllImageGroupsSelect", &Database::EndAllImageGroupsSelect)
253
+ .def("BeginAllParticlePositionAssetsSelect", &Database::BeginAllParticlePositionAssetsSelect)
254
+ .def("GetNextParticlePositionAsset", &Database::GetNextParticlePositionAsset)
255
+ .def("GetNextParticlePositionAssetFromResults", &Database::GetNextParticlePositionAssetFromResults)
256
+ .def("EndAllParticlePositionAssetsSelect", &Database::EndAllParticlePositionAssetsSelect)
257
+ .def("BeginAllParticlePositionGroupsSelect", &Database::BeginAllParticlePositionGroupsSelect)
258
+ .def("GetNextParticlePositionGroup", &Database::GetNextParticlePositionGroup)
259
+ .def("EndAllParticlePositionGroupsSelect", &Database::EndAllParticlePositionGroupsSelect)
260
+ .def("BeginAllVolumeAssetsSelect", &Database::BeginAllVolumeAssetsSelect)
261
+ .def("GetNextVolumeAsset", &Database::GetNextVolumeAsset)
262
+ .def("EndAllVolumeAssetsSelect", &Database::EndAllVolumeAssetsSelect)
263
+ .def("BeginAllVolumeGroupsSelect", &Database::BeginAllVolumeGroupsSelect)
264
+ .def("GetNextVolumeGroup", &Database::GetNextVolumeGroup)
265
+ .def("EndAllVolumeGroupsSelect", &Database::EndAllVolumeGroupsSelect)
266
+ .def("BeginAllRunProfilesSelect", &Database::BeginAllRunProfilesSelect)
267
+ .def("GetNextRunProfile", &Database::GetNextRunProfile)
268
+ .def("EndAllRunProfilesSelect", &Database::EndAllRunProfilesSelect)
269
+ .def("BeginAllRefinementPackagesSelect", &Database::BeginAllRefinementPackagesSelect)
270
+ .def("GetNextRefinementPackage", &Database::GetNextRefinementPackage)
271
+ .def("EndAllRefinementPackagesSelect", &Database::EndAllRefinementPackagesSelect)
272
+ //.def("AddStartupJob", &Database::AddStartupJob)
273
+ .def("AddReconstructionJob", &Database::AddReconstructionJob)
274
+ .def("GetReconstructionJob", [](Database &__inst, long wanted_reconstruction_id)
275
+ {
276
+ long refinement_package_asset_id;
277
+ long refinement_id;
278
+ wxString name;
279
+ float inner_mask_radius;
280
+ float outer_mask_radius;
281
+ float resolution_limit;
282
+ float score_weight_conversion;
283
+ bool should_adjust_score;
284
+ bool should_crop_images;
285
+ bool should_save_half_maps;
286
+ bool should_likelihood_blur;
287
+ float smoothing_factor;
288
+ int class_number;
289
+ long volume_asset_id;
290
+ __inst.GetReconstructionJob(wanted_reconstruction_id, refinement_package_asset_id, refinement_id, name, inner_mask_radius, outer_mask_radius, resolution_limit, score_weight_conversion, should_adjust_score, should_crop_images, should_save_half_maps, should_likelihood_blur, smoothing_factor, class_number, volume_asset_id);
291
+ return std::make_tuple(refinement_package_asset_id, refinement_id, name, inner_mask_radius, outer_mask_radius, resolution_limit, score_weight_conversion, should_adjust_score, should_crop_images, should_save_half_maps, should_likelihood_blur, smoothing_factor, class_number, volume_asset_id);
292
+ })
293
+ .def("GetCTFParameters", [](Database &__inst)
294
+ {
295
+ int ctf_estimation_id;
296
+ double acceleration_voltage;
297
+ double spherical_aberration;
298
+ double amplitude_constrast;
299
+ double defocus_1;
300
+ double defocus_2;
301
+ double defocus_angle;
302
+ double additional_phase_shift;
303
+ double iciness;
304
+ __inst.GetCTFParameters(ctf_estimation_id, acceleration_voltage, spherical_aberration, amplitude_constrast, defocus_1, defocus_2, defocus_angle, additional_phase_shift, iciness);
305
+ return std::make_tuple(ctf_estimation_id, acceleration_voltage, spherical_aberration, amplitude_constrast, defocus_1, defocus_2, defocus_angle, additional_phase_shift, iciness);
306
+ })
307
+ .def("AddCTFIcinessColumnIfNecessary", &Database::AddCTFIcinessColumnIfNecessary)
308
+ .def("RemoveParticlePositionsWithGivenParentImageIDFromGroup", [](Database &__inst)
309
+ {
310
+ int group_number_following_gui_convention;
311
+ int parent_image_asset_id;
312
+ __inst.RemoveParticlePositionsWithGivenParentImageIDFromGroup(group_number_following_gui_convention, parent_image_asset_id);
313
+ return std::make_tuple(group_number_following_gui_convention, parent_image_asset_id);
314
+ })
315
+ .def("RemoveParticlePositionAssetsPickedFromImagesAlsoPickedByGivenPickingJobID", [](Database &__inst)
316
+ {
317
+ int picking_job_id;
318
+ __inst.RemoveParticlePositionAssetsPickedFromImagesAlsoPickedByGivenPickingJobID(picking_job_id);
319
+ return picking_job_id;
320
+ })
321
+ .def("RemoveParticlePositionAssetsPickedFromImageWithGivenID", [](Database &__inst)
322
+ {
323
+ int parent_image_asset_id;
324
+ __inst.RemoveParticlePositionAssetsPickedFromImageWithGivenID(parent_image_asset_id);
325
+ return parent_image_asset_id;
326
+ })
327
+ .def("CopyParticleAssetsFromResultsTable", [](Database &__inst)
328
+ {
329
+ int picking_job_id;
330
+ int parent_image_asset_id;
331
+ __inst.CopyParticleAssetsFromResultsTable(picking_job_id, parent_image_asset_id);
332
+ return std::make_tuple(picking_job_id, parent_image_asset_id);
333
+ })
334
+ /*.def("AddArrayOfParticlePositionAssetsToResultsTable", [](Database &__inst, ArrayOfParticlePositionAssets *array_of_assets)
335
+ {
336
+ int picking_job_id;
337
+ __inst.AddArrayOfParticlePositionAssetsToResultsTable(picking_job_id, array_of_assets);
338
+ return picking_job_id;
339
+ })
340
+ .def("AddArrayOfParticlePositionAssetsToAssetsTable", &Database::AddArrayOfParticlePositionAssetsToAssetsTable)
341
+ .def("ReturnArrayOfParticlePositionAssetsFromResultsTable", [](Database &__inst)
342
+ {
343
+ int picking_job_id;
344
+ int parent_image_asset_id;
345
+ auto __ret = __inst.ReturnArrayOfParticlePositionAssetsFromResultsTable(picking_job_id, parent_image_asset_id);
346
+ return std::make_tuple(__ret, picking_job_id, parent_image_asset_id);
347
+ })
348
+ .def("ReturnArrayOfParticlePositionAssetsFromAssetsTable", [](Database &__inst)
349
+ {
350
+ int parent_image_asset_id;
351
+ auto __ret = __inst.ReturnArrayOfParticlePositionAssetsFromAssetsTable(parent_image_asset_id);
352
+ return std::make_tuple(__ret, parent_image_asset_id);
353
+ })
354
+ */
355
+ .def("RemoveParticlePositionsFromResultsList", [](Database &__inst)
356
+ {
357
+ int picking_job_id;
358
+ int parent_image_asset_id;
359
+ __inst.RemoveParticlePositionsFromResultsList(picking_job_id, parent_image_asset_id);
360
+ return std::make_tuple(picking_job_id, parent_image_asset_id);
361
+ })
362
+ .def("ReturnPickingIDGivenPickingJobIDAndParentImageID", [](Database &__inst)
363
+ {
364
+ int picking_job_id;
365
+ int parent_image_asset_id;
366
+ auto __ret = __inst.ReturnPickingIDGivenPickingJobIDAndParentImageID(picking_job_id, parent_image_asset_id);
367
+ return std::make_tuple(__ret, picking_job_id, parent_image_asset_id);
368
+ })
369
+ .def("SetManualEditForPickingID", [](Database &__inst, const bool wanted_manual_edit)
370
+ {
371
+ int picking_id;
372
+ __inst.SetManualEditForPickingID(picking_id, wanted_manual_edit);
373
+ return picking_id;
374
+ })
375
+ .def("AddRefinement", &Database::AddRefinement)
376
+ .def("UpdateRefinementResolutionStatistics", &Database::UpdateRefinementResolutionStatistics)
377
+ .def("AddTemplateMatchingResult", [](Database &__inst, long wanted_template_match_id)
378
+ {
379
+ TemplateMatchJobResults job_details;
380
+ __inst.AddTemplateMatchingResult(wanted_template_match_id, job_details);
381
+ return job_details;
382
+ })
383
+ .def("GetTemplateMatchingResultByID", &Database::GetTemplateMatchingResultByID)
384
+ .def("AddRefinementAngularDistribution", [](Database &__inst, long refinement_id, int class_number)
385
+ {
386
+ AngularDistributionHistogram histogram_to_add;
387
+ __inst.AddRefinementAngularDistribution(histogram_to_add, refinement_id, class_number);
388
+ return histogram_to_add;
389
+ })
390
+ .def("CopyRefinementAngularDistributions", &Database::CopyRefinementAngularDistributions)
391
+ .def("GetRefinementAngularDistributionHistogramData", [](Database &__inst, long wanted_refinement_id, int wanted_class_number)
392
+ {
393
+ AngularDistributionHistogram histogram_to_fill;
394
+ __inst.GetRefinementAngularDistributionHistogramData(wanted_refinement_id, wanted_class_number, histogram_to_fill);
395
+ return histogram_to_fill;
396
+ })
397
+ .def("GetRefinementByID", &Database::GetRefinementByID)
398
+ .def("AddClassification", &Database::AddClassification)
399
+ .def("GetClassificationByID", &Database::GetClassificationByID)
400
+ .def("CheckandUpdateSchema", [](Database& db) {
401
+ auto [missing_tables, missing_columns] = db.CheckSchema();
402
+ db.UpdateSchema(missing_columns);
403
+ db.UpdateVersion();
404
+ })
405
+
406
+ .def("AddClassificationSelection", &Database::AddClassificationSelection);
407
+
408
+ }
@@ -0,0 +1,72 @@
1
+ #include <pybind11/pybind11.h>
2
+ #include <pybind11/numpy.h>
3
+ #include <pybind11/stl.h>
4
+ #include "core/core_headers.h"
5
+
6
+ namespace py = pybind11;
7
+
8
+ namespace PYBIND11_NAMESPACE { namespace detail {
9
+ template <> struct type_caster<wxString> {
10
+ public:
11
+ /**
12
+ * This macro establishes the name 'inty' in
13
+ * function signatures and declares a local variable
14
+ * 'value' of type inty
15
+ */
16
+ PYBIND11_TYPE_CASTER(wxString, const_name("wxString"));
17
+
18
+ /**
19
+ * Conversion part 1 (Python->C++): convert a PyObject into a inty
20
+ * instance or return false upon failure. The second argument
21
+ * indicates whether implicit conversions should be applied.
22
+ */
23
+ bool load(handle src, bool) {
24
+ /* Extract PyObject from handle */
25
+ PyObject *source = src.ptr();
26
+ /* Try converting into a Python string */
27
+ PyObject *tmp = PyObject_Str(source);
28
+ if (!tmp)
29
+ return false;
30
+ /* Now try to convert into a wxString */
31
+ value.Append(PyUnicode_AsUTF8(tmp));
32
+ Py_DECREF(tmp);
33
+ /* Ensure return code was OK (to avoid out-of-range errors etc) */
34
+ return !PyErr_Occurred();
35
+ }
36
+
37
+ /**
38
+ * Conversion part 2 (C++ -> Python): convert an inty instance into
39
+ * a Python object. The second and third arguments are used to
40
+ * indicate the return value policy and parent object (for
41
+ * ``return_value_policy::reference_internal``) and are generally
42
+ * ignored by implicit casters.
43
+ */
44
+ static handle cast(wxString src, return_value_policy /* policy */, handle /* parent */) {
45
+ return py::str(src.ToStdString());
46
+ }
47
+ };
48
+ }} // namespace PYBIND11_NAMESPACE::detail
49
+
50
+ void init_euler(py::module &m) {
51
+ py::class_<EulerSearch>(m, "EulerSearch")
52
+ .def(py::init<>())
53
+ .def("Init", &EulerSearch::Init)
54
+ .def("InitGrid", &EulerSearch::InitGrid)
55
+ .def("InitRandom", &EulerSearch::InitRandom)
56
+ .def("Run", &EulerSearch::Run)
57
+ .def_readwrite("theta_max", &EulerSearch::theta_max)
58
+ .def_readwrite("number_of_search_positions", &EulerSearch::number_of_search_positions)
59
+ .def_readwrite("test_mirror", &EulerSearch::test_mirror)
60
+ .def("CalculateGridSearchPositions", &EulerSearch::CalculateGridSearchPositions)
61
+ .def("CalculateRandomSearchPositions", &EulerSearch::CalculateRandomSearchPositions)
62
+ .def("SetSymmetryLimits", &EulerSearch::SetSymmetryLimits);
63
+
64
+ py::class_<ParameterMap>(m, "ParameterMap")
65
+ .def(py::init<>())
66
+ .def("SetAllTrue", &ParameterMap::SetAllTrue)
67
+ .def_readwrite("phi", &ParameterMap::phi)
68
+ .def_readwrite("theta", &ParameterMap::theta)
69
+ .def_readwrite("psi", &ParameterMap::psi)
70
+ .def_readwrite("x_shift", &ParameterMap::x_shift)
71
+ .def_readwrite("y_shift", &ParameterMap::y_shift);
72
+ }
@@ -0,0 +1,114 @@
1
+ #include <pybind11/pybind11.h>
2
+ #include <pybind11/numpy.h>
3
+ #include <pybind11/stl.h>
4
+ #include "core/core_headers.h"
5
+
6
+
7
+
8
+ #define STRINGIFY(x) #x
9
+ #define MACRO_STRINGIFY(x) STRINGIFY(x)
10
+
11
+ namespace py = pybind11;
12
+
13
+ namespace PYBIND11_NAMESPACE { namespace detail {
14
+ template <> struct type_caster<wxString> {
15
+ public:
16
+ /**
17
+ * This macro establishes the name 'inty' in
18
+ * function signatures and declares a local variable
19
+ * 'value' of type inty
20
+ */
21
+ PYBIND11_TYPE_CASTER(wxString, const_name("wxString"));
22
+
23
+ /**
24
+ * Conversion part 1 (Python->C++): convert a PyObject into a inty
25
+ * instance or return false upon failure. The second argument
26
+ * indicates whether implicit conversions should be applied.
27
+ */
28
+ bool load(handle src, bool) {
29
+ /* Extract PyObject from handle */
30
+ PyObject *source = src.ptr();
31
+ /* Try converting into a Python string */
32
+ PyObject *tmp = PyObject_Str(source);
33
+ if (!tmp)
34
+ return false;
35
+ /* Now try to convert into a wxString */
36
+ value.Append(PyUnicode_AsUTF8(tmp));
37
+ Py_DECREF(tmp);
38
+ /* Ensure return code was OK (to avoid out-of-range errors etc) */
39
+ return !PyErr_Occurred();
40
+ }
41
+
42
+ /**
43
+ * Conversion part 2 (C++ -> Python): convert an inty instance into
44
+ * a Python object. The second and third arguments are used to
45
+ * indicate the return value policy and parent object (for
46
+ * ``return_value_policy::reference_internal``) and are generally
47
+ * ignored by implicit casters.
48
+ */
49
+ static handle cast(wxString src, return_value_policy /* policy */, handle /* parent */) {
50
+ return py::str(src.ToStdString());
51
+ }
52
+ };
53
+ }} // namespace PYBIND11_NAMESPACE::detail
54
+
55
+ void init_run_profiles(py::module &m) {
56
+ py::class_<RunCommand> runcommand(m, "RunCommand");
57
+ runcommand
58
+ .def(py::init<>())
59
+ .def_readonly("command_to_run", &RunCommand::command_to_run)
60
+ .def_readonly("number_of_copies", &RunCommand::number_of_copies)
61
+ .def("SetCommand", &RunCommand::SetCommand);
62
+
63
+ py::class_<RunProfile> runprofile(m, "RunProfile");
64
+ runprofile
65
+ .def(py::init<>())
66
+ .def("AddCommand", (void (RunProfile::*)(::RunCommand))&RunProfile::AddCommand)
67
+ .def("AddCommand", (void (RunProfile::*)(wxString,int,int,bool,int,int))&RunProfile::AddCommand)
68
+ .def("RemoveCommand", &RunProfile::RemoveCommand)
69
+ .def("RemoveAll", &RunProfile::RemoveAll)
70
+ .def("ReturnTotalJobs", &RunProfile::ReturnTotalJobs)
71
+ .def("SubstituteExecutableName", &RunProfile::SubstituteExecutableName)
72
+ .def("CheckNumberAndGrow", &RunProfile::CheckNumberAndGrow)
73
+ .def_property("name",
74
+ [](const RunProfile &m) { return py::str(m.name.ToStdString()); },
75
+ [](RunProfile &m, wxString &name) { m.name = name; })
76
+ .def_property("manager_command",
77
+ [](RunProfile &m) { return py::str(m.manager_command.ToStdString()); },
78
+ [](RunProfile &m, wxString &s) { m.manager_command = s; })
79
+ .def_property_readonly("run_commands", [](RunProfile const& e) {
80
+ std::vector<RunCommand*> v;
81
+ for (int i = 0; i < e.number_of_run_commands; i++) {
82
+ v.push_back(&e.run_commands[i]);
83
+ }
84
+ return v; });
85
+
86
+ py::class_<RunProfileManager> runprofilemanager(m, "RunProfileManager");
87
+ runprofilemanager
88
+ .def("AddProfile", &RunProfileManager::AddProfile)
89
+ .def("AddBlankProfile", &RunProfileManager::AddBlankProfile)
90
+ .def("AddDefaultLocalProfile", &RunProfileManager::AddDefaultLocalProfile)
91
+ .def("RemoveProfile", &RunProfileManager::RemoveProfile)
92
+ .def("RemoveAllProfiles", &RunProfileManager::RemoveAllProfiles)
93
+ .def("ReturnLastProfilePointer", &RunProfileManager::ReturnLastProfilePointer)
94
+ .def("ReturnProfilePointer", &RunProfileManager::ReturnProfilePointer)
95
+ .def("ReturnProfileName", &RunProfileManager::ReturnProfileName)
96
+ .def("ReturnProfileID", &RunProfileManager::ReturnProfileID)
97
+ .def("ReturnTotalJobs", &RunProfileManager::ReturnTotalJobs)
98
+ .def("WriteRunProfilesToDisk", [](RunProfileManager &e, wxString const &filename, std::vector<int> const &profile_ids) {
99
+ wxArrayInt profile_ids_array;
100
+ for (auto &i : profile_ids) {
101
+ profile_ids_array.Add(i);
102
+ }
103
+ e.WriteRunProfilesToDisk(filename, profile_ids_array);
104
+ })
105
+ .def("ImportRunProfilesFromDisk", &RunProfileManager::ImportRunProfilesFromDisk)
106
+ .def_readonly("number_of_run_profiles", &RunProfileManager::number_of_run_profiles)
107
+ .def_property_readonly("run_profiles", [](RunProfileManager const& e) {
108
+ std::vector<RunProfile*> v;
109
+ for (int i = 0; i < e.number_of_run_profiles; i++) {
110
+ v.push_back(&e.run_profiles[i]);
111
+ }
112
+ return v; })
113
+ .def(py::init<>());
114
+ }