scipion-em-xmipp 24.12.2__py3-none-any.whl → 25.6.0__py3-none-any.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 (139) hide show
  1. {scipion_em_xmipp-24.12.2.dist-info → scipion_em_xmipp-25.6.0.dist-info}/METADATA +10 -10
  2. scipion_em_xmipp-25.6.0.dist-info/RECORD +255 -0
  3. {scipion_em_xmipp-24.12.2.dist-info → scipion_em_xmipp-25.6.0.dist-info}/WHEEL +1 -1
  4. {scipion_em_xmipp-24.12.2.dist-info → scipion_em_xmipp-25.6.0.dist-info}/entry_points.txt +0 -1
  5. xmipp3/__init__.py +106 -73
  6. xmipp3/base.py +2 -1
  7. xmipp3/convert/convert.py +1 -1
  8. xmipp3/legacy/protocols/protocol_angular_resolution_alignment.py +204 -0
  9. xmipp3/legacy/protocols/protocol_apply_deformation_zernike3d.py +113 -0
  10. xmipp3/legacy/protocols/protocol_classification_gpuCorr.py +821 -0
  11. xmipp3/legacy/protocols/protocol_classification_gpuCorr_full.py +1014 -0
  12. xmipp3/legacy/protocols/protocol_classification_gpuCorr_semi.py +462 -0
  13. xmipp3/legacy/protocols/protocol_classify_kmeans2d.py +285 -0
  14. xmipp3/legacy/protocols/protocol_deep_align.py +859 -0
  15. xmipp3/legacy/protocols/protocol_deep_denoising.py +425 -0
  16. xmipp3/legacy/protocols/protocol_kmeans_clustering.py +122 -0
  17. xmipp3/legacy/protocols/protocol_metaprotocol_create_output.py +146 -0
  18. xmipp3/legacy/protocols/protocol_metaprotocol_create_subset.py +96 -0
  19. xmipp3/legacy/protocols/protocol_metaprotocol_discrete_heterogeneity_scheduler.py +516 -0
  20. xmipp3/legacy/protocols/protocol_metaprotocol_golden_highres.py +663 -0
  21. xmipp3/legacy/protocols/protocol_mltomo.py +576 -0
  22. xmipp3/legacy/protocols/protocol_movie_average.py +202 -0
  23. xmipp3/legacy/protocols/protocol_movie_opticalflow.py +416 -0
  24. xmipp3/legacy/protocols/protocol_particle_boxsize.py +133 -0
  25. xmipp3/legacy/protocols/protocol_reconstruct_heterogeneous.py +1031 -0
  26. xmipp3/legacy/protocols/protocol_rotational_spectra.py +212 -0
  27. xmipp3/legacy/protocols/protocol_solid_angles.py +632 -0
  28. xmipp3/legacy/protocols/protocol_split_volume.py +112 -0
  29. xmipp3/legacy/protocols/protocol_split_volume_hierarchical_cluster.py +865 -0
  30. xmipp3/legacy/protocols/protocol_subtract_projection.py +265 -0
  31. xmipp3/legacy/tests/test_protocol_deep_denoising.py +64 -0
  32. xmipp3/legacy/tests/test_protocols_angular_resolution_alignment.py +88 -0
  33. xmipp3/legacy/tests/test_protocols_gpuCorr_classifier.py +141 -0
  34. xmipp3/legacy/tests/test_protocols_gpuCorr_fullStreaming.py +172 -0
  35. xmipp3/legacy/tests/test_protocols_gpuCorr_semiStreaming.py +68 -0
  36. xmipp3/legacy/tests/test_protocols_metaprotocol_golden_highres.py +96 -0
  37. xmipp3/legacy/tests/test_protocols_metaprotocol_heterogeneity.py +78 -0
  38. xmipp3/legacy/tests/test_protocols_mixed_movies.py +148 -0
  39. xmipp3/legacy/tests/test_protocols_solid_angles.py +161 -0
  40. xmipp3/legacy/tests/test_protocols_subtract_projection.py +595 -0
  41. xmipp3/legacy/tests/test_protocols_xmipp_movies.py +229 -0
  42. xmipp3/legacy/viewers/viewer_angular_resolution_alignment.py +148 -0
  43. xmipp3/legacy/viewers/viewer_deep_align.py +121 -0
  44. xmipp3/legacy/viewers/viewer_metaprotocol_golden_highres.py +140 -0
  45. xmipp3/legacy/viewers/viewer_mltomo.py +297 -0
  46. xmipp3/legacy/viewers/viewer_solid_angles.py +91 -0
  47. xmipp3/legacy/viewers/viewer_split_volume.py +57 -0
  48. xmipp3/protocols/__init__.py +1 -2
  49. xmipp3/protocols/protocol_align_volume.py +34 -8
  50. xmipp3/protocols/protocol_apply_alignment.py +1 -1
  51. xmipp3/protocols/protocol_apply_tilt_to_ctf.py +2 -3
  52. xmipp3/protocols/protocol_apply_zernike3d.py +2 -1
  53. xmipp3/protocols/protocol_assignment_tilt_pair.py +1 -2
  54. xmipp3/protocols/protocol_center_particles.py +1 -1
  55. xmipp3/protocols/protocol_cl2d.py +1 -2
  56. xmipp3/protocols/protocol_cl2d_align.py +1 -1
  57. xmipp3/protocols/protocol_cl2d_clustering.py +1 -1
  58. xmipp3/protocols/protocol_classify_pca.py +25 -9
  59. xmipp3/protocols/protocol_classify_pca_streaming.py +67 -42
  60. xmipp3/protocols/protocol_compute_likelihood.py +368 -0
  61. xmipp3/protocols/protocol_consensus_local_ctf.py +1 -1
  62. xmipp3/protocols/protocol_convert_pdb.py +9 -1
  63. xmipp3/protocols/protocol_create_gallery.py +1 -1
  64. xmipp3/protocols/protocol_ctf_consensus.py +14 -8
  65. xmipp3/protocols/protocol_ctf_correct_wiener2d.py +1 -1
  66. xmipp3/protocols/protocol_ctf_micrographs.py +1 -1
  67. xmipp3/protocols/protocol_deep_center_predict.py +10 -1
  68. xmipp3/protocols/protocol_deep_hand.py +19 -2
  69. xmipp3/protocols/protocol_deep_micrograph_screen.py +1 -1
  70. xmipp3/protocols/protocol_extract_asymmetric_unit.py +1 -1
  71. xmipp3/protocols/protocol_extract_particles.py +22 -10
  72. xmipp3/protocols/protocol_extract_particles_movies.py +1 -1
  73. xmipp3/protocols/protocol_extract_particles_pairs.py +1 -1
  74. xmipp3/protocols/protocol_flexalign.py +3 -4
  75. xmipp3/protocols/protocol_helical_parameters.py +1 -4
  76. xmipp3/protocols/protocol_movie_alignment_consensus.py +122 -40
  77. xmipp3/protocols/protocol_movie_dose_analysis.py +79 -82
  78. xmipp3/protocols/protocol_movie_max_shift.py +6 -2
  79. xmipp3/protocols/protocol_movie_split_frames.py +165 -88
  80. xmipp3/protocols/protocol_particle_pick_automatic.py +1 -2
  81. xmipp3/protocols/protocol_particle_pick_consensus.py +7 -0
  82. xmipp3/protocols/protocol_particle_pick_pairs.py +1 -1
  83. xmipp3/protocols/protocol_phantom_create.py +1 -1
  84. xmipp3/protocols/protocol_pick_noise.py +1 -1
  85. xmipp3/protocols/protocol_postProcessing_deepPostProcessing.py +5 -5
  86. xmipp3/protocols/protocol_preprocess/protocol_crop_resize.py +3 -2
  87. xmipp3/protocols/protocol_preprocess/protocol_filter.py +2 -2
  88. xmipp3/protocols/protocol_preprocess/protocol_image_operate.py +2 -2
  89. xmipp3/protocols/protocol_preprocess/protocol_mask.py +1 -1
  90. xmipp3/protocols/protocol_preprocess/protocol_preprocess.py +6 -4
  91. xmipp3/protocols/protocol_preprocess/protocol_process.py +20 -7
  92. xmipp3/protocols/protocol_preprocess_micrographs.py +3 -2
  93. xmipp3/protocols/protocol_projmatch/projmatch_steps.py +1 -1
  94. xmipp3/protocols/protocol_projmatch/protocol_projmatch.py +1 -1
  95. xmipp3/protocols/protocol_random_conical_tilt.py +1 -2
  96. xmipp3/protocols/protocol_ransac.py +41 -37
  97. xmipp3/protocols/protocol_reconstruct_fourier.py +5 -1
  98. xmipp3/protocols/protocol_reconstruct_highres.py +13 -7
  99. xmipp3/protocols/protocol_reconstruct_significant.py +14 -21
  100. xmipp3/protocols/protocol_resolution3d.py +1 -1
  101. xmipp3/protocols/protocol_resolution_deepres.py +1 -1
  102. xmipp3/protocols/protocol_resolution_directional.py +1 -1
  103. xmipp3/protocols/protocol_resolution_fso.py +1 -1
  104. xmipp3/protocols/protocol_resolution_monogenic_signal.py +19 -4
  105. xmipp3/protocols/protocol_rotate_volume.py +1 -1
  106. xmipp3/protocols/protocol_screen_deepConsensus.py +25 -5
  107. xmipp3/protocols/protocol_shift_volume.py +1 -1
  108. xmipp3/protocols/protocol_simulate_ctf.py +5 -3
  109. xmipp3/protocols/protocol_structure_map.py +9 -1
  110. xmipp3/protocols/protocol_subtract_projection.py +25 -10
  111. xmipp3/protocols/protocol_tilt_analysis.py +3 -3
  112. xmipp3/protocols/protocol_validate_fscq.py +2 -2
  113. xmipp3/protocols/protocol_validate_nontilt.py +1 -1
  114. xmipp3/protocols/protocol_volume_adjust_sub.py +8 -4
  115. xmipp3/protocols/protocol_volume_deform_zernike3d.py +1 -1
  116. xmipp3/protocols/protocol_volume_local_sharpening.py +1 -1
  117. xmipp3/protocols/protocol_volume_strain.py +1 -1
  118. xmipp3/protocols.conf +1 -3
  119. xmipp3/tests/test_protocol_likelihood.py +240 -0
  120. xmipp3/tests/test_protocol_split_frames.py +136 -0
  121. xmipp3/tests/test_protocol_validate_fscq.py +2 -2
  122. xmipp3/tests/test_protocols_highres.py +44 -5
  123. xmipp3/tests/test_protocols_xmipp_2d.py +1 -48
  124. xmipp3/tests/test_protocols_xmipp_mics.py +20 -16
  125. xmipp3/tests/test_protocols_xmipp_movies.py +4 -4
  126. xmipp3/version.py +5 -5
  127. xmipp3/viewers/__init__.py +1 -1
  128. xmipp3/viewers/viewer_LL_matrix.py +273 -0
  129. xmipp3/viewers/viewer_deep_consensus.py +1 -7
  130. xmipp3/viewers/viewer_dose_analysis.py +18 -2
  131. xmipp3/viewers/viewer_resolution_fso.py +18 -6
  132. xmipp3/viewers/viewer_structure_map.py +53 -11
  133. xmipp3/wizards.py +3 -2
  134. xmipp3/xmipp_logo_devel.png +0 -0
  135. scipion_em_xmipp-24.12.2.dist-info/RECORD +0 -210
  136. {scipion_em_xmipp-24.12.2.dist-info → scipion_em_xmipp-25.6.0.dist-info}/LICENSE +0 -0
  137. {scipion_em_xmipp-24.12.2.dist-info → scipion_em_xmipp-25.6.0.dist-info}/top_level.txt +0 -0
  138. /xmipp3/{protocols → legacy/protocols}/protocol_enrich.py +0 -0
  139. /xmipp3/{protocols → legacy/protocols}/protocol_screen_deeplearning.py +0 -0
@@ -89,17 +89,56 @@ class TestHighres(BaseTest):
89
89
  particleRadius=180,
90
90
  symmetryGroup="i1",
91
91
  nextResolutionCriterion=0.143,
92
- alignmentMethod=XmippProtReconstructHighRes.AUTOMATIC_ALIGNMENT,
93
- maximumTargetResolution="15 10 7",
94
- numberOfMpi=8)
92
+ alignmentMethod=XmippProtReconstructHighRes.GLOBAL_ALIGNMENT,
93
+ numberOfIterations=1,
94
+ maximumTargetResolution="15",
95
+ numberOfMpi=8,
96
+ postSignificantDenoise=False,
97
+ postFilterBank=False,
98
+ postLaplacian=False,
99
+ postDeconvolve=False,
100
+ postSoftNeg=False,
101
+ postDifference=False)
102
+
95
103
  self.launchProtocol(highres)
96
104
  self.assertIsNotNone(highres.outputParticles,
97
105
  "There was a problem with Highres")
98
106
 
99
- fnResolution = highres._getExtraPath("Iter005/iterInfo.xmd")
107
+ fnResolution = highres._getExtraPath("Iter001/iterInfo.xmd")
108
+ if not exists(fnResolution):
109
+ self.assertTrue(False, fnResolution + " does not exist")
110
+ else:
111
+ md = emlib.MetaData("resolution@" + fnResolution)
112
+ R = md.getValue(emlib.MDL_RESOLUTION_FREQREAL, md.firstObject())
113
+ self.assertTrue(R < 12.5, "Resolution is not below 12.5A")
114
+
115
+ highresLocal = self.newProtocol(XmippProtReconstructHighRes,
116
+ inputParticles=subset.outputParticles,
117
+ inputVolumes=self.protImportVol.outputVolume,
118
+ continueRun=highres,
119
+ doContinue=True,
120
+ particleRadius=180,
121
+ symmetryGroup="i1",
122
+ nextResolutionCriterion=0.143,
123
+ alignmentMethod=XmippProtReconstructHighRes.LOCAL_ALIGNMENT,
124
+ numberOfIterations=1,
125
+ maximumTargetResolution="10",
126
+ numberOfMpi=8,
127
+ postSignificantDenoise=False,
128
+ postFilterBank=False,
129
+ postLaplacian=False,
130
+ postDeconvolve=False,
131
+ postSoftNeg=False,
132
+ postDifference=False)
133
+
134
+ self.launchProtocol(highresLocal)
135
+ self.assertIsNotNone(highresLocal.outputParticles,
136
+ "There was a problem with Highres")
137
+
138
+ fnResolution = highresLocal._getExtraPath("Iter002/iterInfo.xmd")
100
139
  if not exists(fnResolution):
101
140
  self.assertTrue(False, fnResolution + " does not exist")
102
141
  else:
103
142
  md = emlib.MetaData("resolution@" + fnResolution)
104
143
  R = md.getValue(emlib.MDL_RESOLUTION_FREQREAL, md.firstObject())
105
- self.assertTrue(R < 10, "Resolution is not below 10A")
144
+ self.assertTrue(R < 12.5, "Resolution is not below 12.5A")
@@ -1453,54 +1453,6 @@ class TestXmippPickNoise(TestXmippBase):
1453
1453
  self.assertEquals(protPickNoise1.outputCoordinates.getSize(), 143, (MSG_WRONG_SIZE, "noisy particles"))
1454
1454
  self.assertEquals(protPickNoise2.outputCoordinates.getSize(), 140, (MSG_WRONG_SIZE, "noisy particles"))
1455
1455
 
1456
- class TestXmippScreenDeepLearning(TestXmippBase):
1457
- """This class checks if the protocol screen deep learning in Xmipp works properly."""
1458
- @classmethod
1459
- def setUpClass(cls):
1460
- setupTestProject(cls)
1461
- cls.dataset = DataSet.getDataSet('xmipp_tutorial')
1462
-
1463
- def testXmippScreenDeepLearning(self):
1464
- protImportParts1 = self.newProtocol(emprot.ProtImportParticles,
1465
- objLabel='First Set of Particles',
1466
- importFrom=emprot.ProtImportParticles.IMPORT_FROM_SCIPION,
1467
- sqliteFile=self.dataset.getFile('particles/BPV_particles.sqlite'),
1468
- magnification=50000,
1469
- samplingRate=7.08,
1470
- haveDataBeenPhaseFlipped=False)
1471
- self.launchProtocol(protImportParts1)
1472
- self.assertIsNotNone(protImportParts1.getFiles(), (MSG_WRONG_IMPORT, "the first set of particles"))
1473
-
1474
- protImportParts2 = self.newProtocol(emprot.ProtImportParticles,
1475
- objLabel='Second Set of Particles',
1476
- importFrom=emprot.ProtImportParticles.IMPORT_FROM_SCIPION,
1477
- sqliteFile=self.dataset.getFile('particles/BPV_particles_aligned.sqlite'),
1478
- magnification=50000,
1479
- samplingRate=7.08,
1480
- haveDataBeenPhaseFlipped=False)
1481
- self.launchProtocol(protImportParts2)
1482
- self.assertIsNotNone(protImportParts2.getFiles(), (MSG_WRONG_IMPORT, "the second set of particles"))
1483
-
1484
- protAddNoise = self.newProtocol(XmippProtAddNoiseParticles,
1485
- input=protImportParts1.outputParticles,
1486
- gaussianStd=15.0)
1487
- self.launchProtocol(protAddNoise)
1488
- self.assertIsNotNone(protAddNoise.outputParticles, (MSG_WRONG_PROTOCOL, "add noise"))
1489
-
1490
- protScreenDeepLearning = self.newProtocol(XmippProtScreenDeepLearning,
1491
- inTrueSetOfParticles=protImportParts1.outputParticles,
1492
- numberOfNegativeSets=1,
1493
- negativeSet_1=protAddNoise.outputParticles,
1494
- predictSetOfParticles=protImportParts2.outputParticles)
1495
- self.launchProtocol(protScreenDeepLearning)
1496
- self.assertIsNotNone(protScreenDeepLearning.getFiles(), (MSG_WRONG_PROTOCOL, "screen deep learning"))
1497
- self.assertIsNotNone(protScreenDeepLearning.outputParticles, (MSG_WRONG_OUTPUT, "particles"))
1498
- # Check the size of the output particles
1499
- self.assertEquals(protScreenDeepLearning.outputParticles.getSize(), 373, (MSG_WRONG_SIZE, "particles"))
1500
- # Check the dimensions of the first particle
1501
- self.assertEquals(protScreenDeepLearning.outputParticles.getFirstItem().getDim(), (140, 140, 1), (MSG_WRONG_DIM, "particles"))
1502
- # Check the sampling rate of the first particle
1503
- self.assertEqual(protScreenDeepLearning.outputParticles.getFirstItem().getSamplingRate(), 7.08, (MSG_WRONG_SAMPLING, "particles"))
1504
1456
 
1505
1457
  class TestXmippClassifyPca(TestXmippBase):
1506
1458
  """This class check if the protocol Classify PCA (static and in streaming) in Xmipp works properly."""
@@ -1601,6 +1553,7 @@ class TestXmippClassifyPca(TestXmippBase):
1601
1553
 
1602
1554
  self.assertSetSize(prot.outputClasses, size, msg)
1603
1555
 
1556
+
1604
1557
  class TestXmippProtCL2DClustering(TestXmippBase):
1605
1558
  """This class check if the protocol clustering 2d classes in Xmipp works properly."""
1606
1559
 
@@ -532,7 +532,7 @@ class TestXmippExtractParticles(TestXmippBase):
532
532
  %(micNameCoord, micNamePart))
533
533
  compare(83)
534
534
  compare(228)
535
- self._checkVarianceAndGiniCoeff(outputParts[170], 1.1640, 0.5190)
535
+ self._checkVarianceAndGiniCoeff(outputParts[170], 1.3000, 0.40817)
536
536
 
537
537
  def testExtractOriginal(self):
538
538
  print("Run extract particles from the original micrographs")
@@ -573,7 +573,7 @@ class TestXmippExtractParticles(TestXmippBase):
573
573
  "Output sampling rate should be equal to input "
574
574
  "sampling rate.")
575
575
  self._checkSamplingConsistency(outputParts)
576
- self._checkVarianceAndGiniCoeff(outputParts[170], 1.2081, 0.5754)
576
+ self._checkVarianceAndGiniCoeff(outputParts[170], 1.2859, 0.3991)
577
577
 
578
578
  def testNoExtractBorders(self):
579
579
  print("Run extract particles avoiding extract in borders")
@@ -620,7 +620,7 @@ class TestXmippExtractParticles(TestXmippBase):
620
620
  self.assertAlmostEquals(outputParts.getSize(), 403, delta=1)
621
621
  self._checkSamplingConsistency(outputParts)
622
622
  # Particle 335 is outbourder with this boxsize. Checking it...
623
- self._checkVarianceAndGiniCoeff(outputParts[335], 1.2191, 0.5795)
623
+ self._checkVarianceAndGiniCoeff(outputParts[335], 1.2101, 0.7079)
624
624
 
625
625
  def testExtractOther(self):
626
626
  print("Run extract particles from original micrographs, with downsampling")
@@ -671,7 +671,7 @@ class TestXmippExtractParticles(TestXmippBase):
671
671
  for particle in outputParts:
672
672
  self.assertTrue(particle.getCoordinate().getMicId() in micsId)
673
673
  self.assertAlmostEqual(outputSampling, particle.getSamplingRate())
674
- self._checkVarianceAndGiniCoeff(outputParts[170], 1.099442, 0.396918)
674
+ self._checkVarianceAndGiniCoeff(outputParts[170], 1.00277, 0.42318)
675
675
 
676
676
  def testExtractNoise(self):
677
677
  # here we will try a different patchSize than the default
@@ -694,7 +694,7 @@ class TestXmippExtractParticles(TestXmippBase):
694
694
  outputParts = protExtract.outputParticles
695
695
  self.assertIsNotNone(outputParts, "There was a problem generating the output.")
696
696
  self.assertAlmostEquals(outputParts.getSize(), 403, delta=1)
697
- self._checkVarianceAndGiniCoeff(outputParts[170], 1.161262, 0.5702)
697
+ self._checkVarianceAndGiniCoeff(outputParts[170], 1.0374, 0.476623)
698
698
 
699
699
  def testExtractCTF(self):
700
700
  print("Run extract particles with CTF")
@@ -738,7 +738,7 @@ class TestXmippExtractParticles(TestXmippBase):
738
738
  "There was a problem generating the output.")
739
739
  self.assertTrue(outputParts.hasCTF(), "Output does not have CTF.")
740
740
  self._checkSamplingConsistency(outputParts)
741
- self._checkVarianceAndGiniCoeff(outputParts[170], 1.1640, 0.5190)
741
+ self._checkVarianceAndGiniCoeff(outputParts[170], 1.3000, 0.4082)
742
742
 
743
743
 
744
744
  class TestXmippVarianceFiltering(TestXmippBase):
@@ -960,26 +960,28 @@ class TestXmippParticlesPickConsensus(TestXmippBase):
960
960
  self.proj.launchProtocol(protAutomaticPP, wait=True)
961
961
 
962
962
  # NON streaming tests
963
- protCons1 = self.newProtocol(XmippProtConsensusPicking,
964
- objLabel="Xmipp - consensus pick AND")
963
+ protCons1 = self.newProtocol(XmippProtConsensusPicking)
964
+ protCons1.setObjLabel("Xmipp - consensus pick AND")
965
+
965
966
  protCons1.inputCoordinates.set([self.protFaPi.outputCoordinates,
966
967
  protAutomaticPP.outputCoordinates])
967
968
  self.launchProtocol(protCons1)
968
969
 
969
970
  self.assertTrue(protCons1.isFinished(), "Consensus failed")
970
- self.assertSetSize(protCons1.consensusCoordinates,382,
971
+ self.assertSetSize(protCons1.consensusCoordinates,306,
971
972
  "Output coordinates size for AND consensus is wrong.")
972
973
 
973
974
  protConsOr = self.newProtocol(XmippProtConsensusPicking,
974
- objLabel="Xmipp - consensus pick OR",
975
975
  consensus=1)
976
+ protConsOr.setObjLabel("Xmipp - consensus pick OR")
977
+
976
978
  protConsOr.inputCoordinates.set(
977
979
  [Pointer(self.protFaPi, extended="outputCoordinates"),
978
980
  Pointer(protAutomaticPP, extended="outputCoordinates")])
979
981
  self.launchProtocol(protConsOr)
980
982
 
981
983
  self.assertTrue(protConsOr.isFinished(), "Consensus failed")
982
- self.assertSetSize(protConsOr.consensusCoordinates, 432,
984
+ self.assertSetSize(protConsOr.consensusCoordinates, 439,
983
985
  "Output coordinates size for OR consensus is wrong.")
984
986
 
985
987
  kwargs = {'nDim': 3, # 3 objects
@@ -1000,8 +1002,9 @@ class TestXmippParticlesPickConsensus(TestXmippBase):
1000
1002
  self._waitOutput(protAutoPP, 'outputCoordinates')
1001
1003
 
1002
1004
  # Consensus Picking launching
1003
- protCons2 = self.newProtocol(XmippProtConsensusPicking,
1004
- objLabel="Xmipp - consensus pick streaming")
1005
+ protCons2 = self.newProtocol(XmippProtConsensusPicking)
1006
+ protCons2.setObjLabel("Xmipp - consensus streaming")
1007
+
1005
1008
  protCons2.inputCoordinates.set(
1006
1009
  [Pointer(self.protFaPi, extended="outputCoordinates"),
1007
1010
  Pointer(protAutoPP, extended="outputCoordinates")])
@@ -1009,17 +1012,18 @@ class TestXmippParticlesPickConsensus(TestXmippBase):
1009
1012
 
1010
1013
  # Remove Duplicates launching
1011
1014
  protDupl2 = self.newProtocol(XmippProtPickingRemoveDuplicates,
1012
- objLabel="Xmipp - remove duplicates streaming",
1013
1015
  consensusRadius=110)
1016
+ protDupl2.setObjLabel("Xmipp - remove duplicates streaming")
1017
+
1014
1018
  protDupl2.inputCoordinates.set(protAutoPP.outputCoordinates)
1015
1019
  self.proj.launchProtocol(protDupl2, wait=True) # don't wait to make the final checks
1016
1020
 
1017
1021
  time.sleep(3) # protDupl2 should be as long as protCons2, but just in case
1018
1022
  protCons2 = self._updateProtocol(protCons2)
1019
- self.assertSetSize(protCons2.consensusCoordinates, 382,
1023
+ self.assertSetSize(protCons2.consensusCoordinates, 306,
1020
1024
  "Output coordinates size does not is wrong.")
1021
1025
  protDupl2 = self._updateProtocol(protDupl2)
1022
- self.assertSetSize(protDupl2.outputCoordinates, 245,
1026
+ self.assertSetSize(protDupl2.outputCoordinates, 203,
1023
1027
  "Output coordinates size does not is wrong.")
1024
1028
 
1025
1029
 
@@ -30,6 +30,7 @@ from pyworkflow.tests import *
30
30
 
31
31
  from xmipp3.convert import *
32
32
  from xmipp3.protocols import *
33
+ from pwem.objects import SetOfMovies, MovieAlignment
33
34
  from pwem.protocols import ProtImportMovies, ProtImportCoordinates
34
35
  import pyworkflow.utils as pwutils
35
36
  from contextlib import redirect_stdout
@@ -774,8 +775,7 @@ class TestMovieAlignmentConsensus(BaseTest):
774
775
  self.launchProtocol(protConsensus1)
775
776
 
776
777
  sizeAccepted = protConsensus1.outputMovies.getSize()
777
- self.assertEqual(sizeAccepted, 2, 'Number of accepted movies must be 2 and its '
778
- '%d' % sizeAccepted)
778
+ self.assertEqual(sizeAccepted, 2, 'Number of accepted movies must be 2 and its %d' % sizeAccepted)
779
779
 
780
780
  def testMovieAlignmentConsensusFiltering2(self):
781
781
  """ This must discard movies by movie alignment consensus.
@@ -784,6 +784,7 @@ class TestMovieAlignmentConsensus(BaseTest):
784
784
  protConsensus2 = self.newProtocol(XmippProtConsensusMovieAlignment,
785
785
  objLabel=label,
786
786
  minConsCorrelation=0.9,
787
+ minRangeShift=0.01,
787
788
  trajectoryPlot=True
788
789
  )
789
790
 
@@ -796,5 +797,4 @@ class TestMovieAlignmentConsensus(BaseTest):
796
797
  self.launchProtocol(protConsensus2)
797
798
 
798
799
  sizeDiscarded = protConsensus2.outputMoviesDiscarded.getSize()
799
- self.assertEqual(sizeDiscarded, 2, 'Number of accepted movies must be 2 and its '
800
- '%d' % sizeDiscarded)
800
+ self.assertEqual(sizeDiscarded, 2, 'Number of discarded movies must be 0 and its %d' % sizeDiscarded)
xmipp3/version.py CHANGED
@@ -28,11 +28,11 @@
28
28
  type_of_version = 'release' #'release' 'devel'
29
29
  _logo = "xmipp_logo" + ("" if type_of_version == 'release' else '_devel') + '.png'
30
30
 
31
- _binVersion = 'v3.24.12.0' # Increase it if hotfix in binaries (xmipp, xmippCore and/or XmippViz)
32
- _pluginVersion = 'v3.24.12.2' # Increase it if hotfix in binaries (xmipp, xmippCore and/or XmippViz) or in scipion-em-xmipp
31
+ _binVersion = 'v3.25.06.0' # Increase it if hotfix in binaries (xmipp, xmippCore and/or XmippViz)
32
+ _pluginVersion = 'v3.25.06.0' # Increase it if hotfix in binaries (xmipp, xmippCore and/or XmippViz) or in scipion-em-xmipp
33
33
 
34
- _binTagVersion = _binVersion + '-Poseidon' #'devel' or _binVersion + '-Poseidon'
35
- _pluginTagVersion = _pluginVersion + '-Poseidon' #'devel' or _pluginVersion + '-Poseidon'
34
+ _binTagVersion = _binVersion + '-Rhea' #'devel' or _binVersion + '-Poseidon'
35
+ _pluginTagVersion = _pluginVersion + '-Rhea' #'devel' or _pluginVersion + '-Poseidon'
36
36
 
37
37
  _currentDepVersion = '1.0'
38
- __version__ = _pluginVersion # Name of the pypi package
38
+ __version__ = _pluginVersion[3:] # Name of the pypi package
@@ -27,7 +27,6 @@
27
27
  from .viewer import XmippViewer
28
28
  from .plotter import XmippPlotter
29
29
 
30
- #from .viewer_angular_resolution_alignment import XmippProtAngResAlignViewer
31
30
  from .viewer_apply_tilt_to_ctf import XmippApplyTiltToCTFViewer
32
31
  from .viewer_cl2d import XmippCL2DViewer
33
32
  from .viewer_ctf_consensus import XmippCTFConsensusViewer
@@ -61,6 +60,7 @@ from .viewer_cl2d_clustering import XmippCL2DClusteringViewer
61
60
  #from .viewer_combine_pdb import XmippProtCombinePdbViewer
62
61
 
63
62
  from .viewer_projmatch import XmippProjMatchViewer
63
+ from .viewer_LL_matrix import XmippLogLikelihoodViewer
64
64
 
65
65
  from .viewer_volume_deform_zernike3d import XmippVolumeDeformZernike3DViewer
66
66
  from .viewer_structure_map import XmippProtStructureMapViewer
@@ -0,0 +1,273 @@
1
+ # **************************************************************************
2
+ # *
3
+ # * Authors: J.M. De la Rosa Trevin (jmdelarosa@cnb.csic.es)
4
+ # * Slavica Jonic (slavica.jonic@upmc.fr)
5
+ # * James Krieger (jmkrieger@cnb.csic.es)
6
+ # * Ricardo Serrano Gutiérrez (rserranogut@hotmail.com)
7
+ # *
8
+ # * This program is free software; you can redistribute it and/or modify
9
+ # * it under the terms of the GNU General Public License as published by
10
+ # * the Free Software Foundation; either version 2 of the License, or
11
+ # * (at your option) any later version.
12
+ # *
13
+ # * This program is distributed in the hope that it will be useful,
14
+ # * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # * GNU General Public License for more details.
17
+ # *
18
+ # * You should have received a copy of the GNU General Public License
19
+ # * along with this program; if not, write to the Free Software
20
+ # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21
+ # * 02111-1307 USA
22
+ # *
23
+ # * All comments concerning this program package may be sent to the
24
+ # * e-mail address 'scipion@cnb.csic.es'
25
+ # *
26
+ # **************************************************************************
27
+ """
28
+ This module implement the wrappers around ProDy GNM
29
+ visualization programs.
30
+ """
31
+ import matplotlib.pyplot as plt
32
+ import matplotlib.ticker as ticker
33
+ import numpy as np
34
+ import os
35
+
36
+ from pwem.viewers.plotter import EmPlotter
37
+ from pwem.objects.data import Volume
38
+
39
+ from pyworkflow.protocol.params import LabelParam, IntParam, FloatParam, BooleanParam
40
+ from pyworkflow.viewer import ProtocolViewer, DESKTOP_TKINTER, WEB_DJANGO
41
+
42
+ from xmipp3.protocols.protocol_compute_likelihood import XmippProtComputeLikelihood
43
+
44
+ _invalidInputStr = 'Invalid input'
45
+
46
+ class XmippLogLikelihoodViewer(ProtocolViewer):
47
+ """ Visualization of results from the Xmipp log likelihood protocol.
48
+ """
49
+ _label = 'Log likelihood matrix viewer'
50
+ _targets = [XmippProtComputeLikelihood]
51
+ _environments = [DESKTOP_TKINTER, WEB_DJANGO]
52
+
53
+ def _defineParams(self, form):
54
+
55
+ self.particles = self.protocol.inputParticles.get()
56
+ self.refs = self.protocol.inputRefs.get()
57
+ self.outputs = self.protocol.reprojections
58
+
59
+ if isinstance(self.refs, Volume):
60
+ self.refs = [self.refs]
61
+
62
+ form.addSection(label='Visualization')
63
+
64
+ group = form.addGroup('Particles range')
65
+ group.addParam('partNumber1', IntParam, default=-1,
66
+ label='Initial particle id',
67
+ help='')
68
+ group.addParam('partNumber2', IntParam, default=-1,
69
+ label='Final particle id')
70
+
71
+ group = form.addGroup('Volumes range')
72
+ group.addParam('volNumber1', IntParam, default=-1,
73
+ label='Initial volume number')
74
+ group.addParam('volNumber2', IntParam, default=-1,
75
+ label='Final volume number')
76
+
77
+ group = form.addGroup('Values for matrix plot')
78
+ group.addParam('normalise', BooleanParam, default=False,
79
+ label='Normalise LL matrix by dividing by mean value of each column?',
80
+ help='This may increase the contrast to help with interpretability. '
81
+ 'Note: we keep the sign negative to keep the order of values.')
82
+
83
+ group.addParam('subtract', BooleanParam, default=True,
84
+ label='Shift LL matrix by subtracting mean value of each column?',
85
+ help='This may increase the contrast to help with interpretability. ')
86
+
87
+ group.addParam('vmin', FloatParam, default=-1,
88
+ label='Minimum blue value',
89
+ help='All values below this will be coloured blue if not -1')
90
+ group.addParam('vmax', FloatParam, default=-1,
91
+ label='Maximum yellow value',
92
+ help='All values above this will be coloured yellow if not -1')
93
+ group.addParam('percentile', FloatParam, default=-1,
94
+ label='Percentile alternative to vmin and vmax',
95
+ help='If either of the above values is -1, they will be estimated as this percentile')
96
+
97
+ group.addParam('displayLL', LabelParam, default=False,
98
+ label="Plot log likelihood matrix?",
99
+ help="Matrices are shown as heatmaps.")
100
+
101
+ group = form.addGroup('Values for histogram')
102
+ group.addParam('nBins', IntParam, default=100, label='Number of bins for histogram')
103
+
104
+ group.addParam('vminH', FloatParam, default=-1,
105
+ label='Minimum axis value',
106
+ help='All values below this will be cropped off the axis if not -1')
107
+ group.addParam('vmaxH', FloatParam, default=-1,
108
+ label='Maximum axis value',
109
+ help='All values above this will be cropped off the axis if not -1')
110
+ group.addParam('percentileH', FloatParam, default=-1,
111
+ label='Percentile alternative to axis vmin and vmax',
112
+ help='If either of the above values is -1, they will be estimated as this percentile')
113
+
114
+ group.addParam('displayRelativeLL', LabelParam, default=False,
115
+ label="Plot relative log likelihood histogram?",
116
+ help="Subtracted log likelihood is shown as a histogram.")
117
+
118
+ def _getVisualizeDict(self):
119
+ return {'displayLL': self._viewLL,
120
+ 'displayRelativeLL': self._viewRelativeLL}
121
+
122
+ def _viewLL(self, paramName):
123
+ """ visualization of log likelihood matrix for selected particles and ref volumes."""
124
+ x = self._checkNumbers('particle')
125
+ if x is not True:
126
+ return x
127
+
128
+ x = self._checkNumbers('volume')
129
+ if x is not True:
130
+ return x
131
+
132
+ matrix = np.load(self.protocol._getExtraPath('matrix.npy'))
133
+
134
+ if self.normalise.get():
135
+ matrix = np.divide(matrix, np.mean(matrix, axis=0)) * np.sign(np.mean(matrix))
136
+
137
+ elif self.subtract.get():
138
+ matrix = np.subtract(matrix, np.mean(matrix, axis=0))
139
+
140
+ if self.vmin.get() != -1:
141
+ vmin = self.vmin.get()
142
+ elif self.percentile.get() != -1:
143
+ vmin = np.percentile(matrix, self.percentile.get())
144
+ else:
145
+ vmin = None
146
+
147
+ if self.vmax.get() != -1:
148
+ vmax = self.vmax.get()
149
+ elif self.percentile.get() != -1:
150
+ vmax = np.percentile(matrix, 100-self.percentile.get())
151
+ else:
152
+ vmax = None
153
+
154
+ plotter = EmPlotter()
155
+ im = plt.imshow(matrix, aspect='auto',
156
+ vmin=vmin, vmax=vmax)
157
+ plt.colorbar(mappable=im)
158
+
159
+ plt.ylabel('Reference volumes')
160
+ plt.ylim([self.volNum1-1.5, self.volNum2-0.5])
161
+ ylocs, _ = plt.yticks()
162
+ plt.yticks([int(loc) for loc in ylocs[:-1] if loc >= self.volNum1-1],
163
+ [str(int(loc)+1) for loc in ylocs[:-1] if loc >= self.volNum1-1])
164
+
165
+ plt.xlabel('Input particles')
166
+ plt.xlim([self.partNum1-1.5, self.partNum2-0.5])
167
+ xlocs, _ = plt.xticks()
168
+ plt.xticks([int(loc) for loc in xlocs[:-1] if loc >= self.partNum1-1],
169
+ [str(int(loc)+1) for loc in xlocs[:-1] if loc >= self.partNum1-1])
170
+
171
+ return [plotter]
172
+
173
+ def _viewRelativeLL(self, paramName):
174
+ """ visualization of relative log likelihood histogram for for selected particles and ref volumes."""
175
+ x = self._checkNumbers('particle')
176
+ if x is not True:
177
+ return x
178
+
179
+ x = self._checkNumbers('volume')
180
+ if x is not True:
181
+ return x
182
+
183
+ if isinstance(self.refs, Volume):
184
+ self.refs = [self.refs]
185
+
186
+ matrix = np.load(self.protocol._getExtraPath('matrix.npy'))
187
+ matrix = np.subtract(matrix[self.volNum1-1, self.partNum1-1:self.partNum2],
188
+ matrix[self.volNum2-1, self.partNum1-1:self.partNum2])
189
+
190
+ plotter = EmPlotter()
191
+ _ = plt.hist(matrix, bins=self.nBins.get())
192
+ plt.xlabel('Relative log likelihood')
193
+
194
+ if self.vminH.get() != -1:
195
+ vmin = self.vminH.get()
196
+ elif self.percentileH.get() != -1:
197
+ vmin = np.percentile(matrix, self.percentileH.get())
198
+ else:
199
+ vmin = None
200
+
201
+ if self.vmaxH.get() != -1:
202
+ vmax = self.vmaxH.get()
203
+ elif self.percentileH.get() != -1:
204
+ vmax = np.percentile(matrix, 100-self.percentileH.get())
205
+ else:
206
+ vmax = None
207
+
208
+ plt.xlim([vmin, vmax])
209
+
210
+ return [plotter]
211
+
212
+
213
+ def _checkNumbers(self, string):
214
+
215
+ if self.normalise.get() and self.subtract.get():
216
+ return [self.errorMessage("Please select normalise or subtract, not both",
217
+ title=_invalidInputStr)]
218
+
219
+ items, number1, number2 = self._setNumbers(string)
220
+
221
+ if len(self.refs) == 1:
222
+ return True
223
+
224
+ if number1+1 > number2:
225
+ return [self.errorMessage("Invalid {0} range\n"
226
+ "Initial {0} number can not be "
227
+ "bigger than the final one.".format(string),
228
+ title=_invalidInputStr)]
229
+
230
+ elif number1 < -1:
231
+ return [self.errorMessage("Invalid {0} range\n"
232
+ "Initial {0} number can not be "
233
+ "smaller than -1.".format(string),
234
+ title=_invalidInputStr)]
235
+
236
+ elif number2 < -1:
237
+ return [self.errorMessage("Invalid {0} range\n"
238
+ "Final {0} number can not be "
239
+ "smaller than -1.".format(string),
240
+ title=_invalidInputStr)]
241
+
242
+ if number1 != -1:
243
+ try:
244
+ _ = items[number1]
245
+ except IndexError:
246
+ return [self.errorMessage("Invalid initial {0} number {1}\n"
247
+ "Display the output {0}s to see "
248
+ "the availables ones.".format(string, number1+1),
249
+ title=_invalidInputStr)]
250
+
251
+ if number2 != -1:
252
+ try:
253
+ _ = items[number2-1]
254
+ except IndexError:
255
+ return [self.errorMessage("Invalid final {0} number {1}\n"
256
+ "Display the output {0}s to see "
257
+ "the availables ones.".format(string, number2),
258
+ title=_invalidInputStr)]
259
+
260
+ return True
261
+
262
+ def _setNumbers(self, string):
263
+
264
+ if string == 'particle':
265
+ items = self.particles
266
+ number1 = self.partNum1 = self.partNumber1.get() if self.partNumber1.get() != -1 else 1
267
+ number2 = self.partNum2 = self.partNumber2.get() if self.partNumber2.get() != -1 else len(self.particles)
268
+ else:
269
+ items = self.refs
270
+ number1 = self.volNum1 = self.volNumber1.get() if self.volNumber1.get() != -1 else 1
271
+ number2 = self.volNum2 = self.volNumber2.get() if self.volNumber2.get() != -1 else len(self.refs)
272
+
273
+ return items, number1, number2
@@ -33,7 +33,6 @@ from pyworkflow.viewer import DESKTOP_TKINTER, WEB_DJANGO, ProtocolViewer
33
33
 
34
34
  from pwem import emlib
35
35
  from xmipp3.protocols.protocol_screen_deepConsensus import XmippProtScreenDeepConsensus
36
- from xmipp3.protocols.protocol_screen_deeplearning import XmippProtScreenDeepLearning
37
36
  from .plotter import XmippPlotter
38
37
 
39
38
  class XmippDeepConsensusViewer(ProtocolViewer):
@@ -45,7 +44,7 @@ class XmippDeepConsensusViewer(ProtocolViewer):
45
44
  """
46
45
  _label = 'viewer deepConsensus'
47
46
  _environments = [DESKTOP_TKINTER, WEB_DJANGO]
48
- _targets = [XmippProtScreenDeepConsensus, XmippProtScreenDeepLearning]
47
+ _targets = [XmippProtScreenDeepConsensus]
49
48
 
50
49
  def _defineParams(self, form):
51
50
  form.addSection(label='Visualization')
@@ -83,11 +82,6 @@ class XmippDeepConsensusViewer(ProtocolViewer):
83
82
  objId = self.protocol.outputCoordinates.strId()
84
83
  otherParam = {'other': 'deepCons'}
85
84
 
86
- elif (isinstance(self.protocol, XmippProtScreenDeepLearning) and
87
- self.protocol.hasAttribute('outputParticles')):
88
- parts = self.protocol.outputParticles
89
- fnParts = parts.getFileName()
90
- objId = parts.strId()
91
85
 
92
86
  if objId:
93
87
  views.append(ObjectView(
@@ -75,19 +75,35 @@ class XmippMovieDoseAnalysisViewer(EmProtocolViewer):
75
75
  def _visualizeDoseTime(self, e=None):
76
76
  if os.path.exists(self.protocol.getDosePlot()):
77
77
  image = plt.imread(self.protocol.getDosePlot())
78
- plt.figure()
78
+ # Get the image dimensions (height, width)
79
+ height, width, _ = image.shape
80
+ # Convert pixels to inches for the figure size (assuming 100 DPI)
81
+ dpi = 100
82
+ figsize = (width / dpi, height / dpi)
83
+ # Create the figure with the calculated size
84
+ plt.figure(figsize=figsize)
85
+ # Display the image without axes
79
86
  fig = plt.imshow(image)
80
87
  fig.axes.get_xaxis().set_visible(False)
81
88
  fig.axes.get_yaxis().set_visible(False)
89
+ # Show the image
82
90
  plt.show()
83
91
 
84
92
  def _visualizeDoseDiffTime(self, e=None):
85
93
  if os.path.exists(self.protocol.getDoseDiffPlot()):
86
94
  image = plt.imread(self.protocol.getDoseDiffPlot())
87
- plt.figure()
95
+ # Get the image dimensions (height, width)
96
+ height, width, _ = image.shape
97
+ # Convert pixels to inches for the figure size (assuming 100 DPI)
98
+ dpi = 100
99
+ figsize = (width / dpi, height / dpi)
100
+ # Create the figure with the calculated size
101
+ plt.figure(figsize=figsize)
102
+ # Display the image without axes
88
103
  fig = plt.imshow(image)
89
104
  fig.axes.get_xaxis().set_visible(False)
90
105
  fig.axes.get_yaxis().set_visible(False)
106
+ # Show the image
91
107
  plt.show()
92
108
 
93
109
  def _visualizeMovies(self, objName):