From d566be2bb858f8a99047c8c9c554cf2c748e7682 Mon Sep 17 00:00:00 2001 From: Doeke Hekstra Date: Wed, 20 Sep 2023 12:40:10 -0400 Subject: [PATCH 1/2] add flag for other img formats --- cog/commands/index.py | 5 ++++- cog/core/experiment.py | 14 +++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/cog/commands/index.py b/cog/commands/index.py index c0ccc05..79ca137 100644 --- a/cog/commands/index.py +++ b/cog/commands/index.py @@ -9,6 +9,7 @@ def index( spacegroup=None, distance=None, center=None, + format="RayonixMX340", phi=0.0, resolution=2.0, spot_profile=(6, 4, 4), @@ -34,6 +35,8 @@ def index( Detector distance in mm center : tuple(center_x, center_y) Coordinates of beam center in pixels + format : string (optional) + Image format to use by Precognition phi : float Phi angle of goniometer resolution : float @@ -79,7 +82,7 @@ def index( f" Pixel 0.08854 0.08854\n" f" Omega 0 0\n" f" Goniometer 0 0 {phi}\n" - f" Format RayonixMX340\n" + f" Format {format}\n" f"{matrixline}" f" Image {image}\n" f" Resolution {resolution:.2f} 100\n" diff --git a/cog/core/experiment.py b/cog/core/experiment.py index 99eab06..15bccae 100644 --- a/cog/core/experiment.py +++ b/cog/core/experiment.py @@ -23,6 +23,7 @@ def __init__( pixelSize=(0.08854, 0.08854), cell=None, spacegroup=None, + format="RayonixMX340", ): # Initialize attributes @@ -33,7 +34,7 @@ def __init__( self.pixelSize = pixelSize self.cell = cell self.spacegroup = spacegroup - + self.format = format return # -------------------------------------------------------------------# @@ -144,6 +145,16 @@ def numImages(self): """ return len(self.images) + @property + def format(self): + """Image format to use by Precognition""" + return self._format + + @format.setter + def format(self, val): + self._format = val + + # ----------------------------------------------------------------------# # Methods @@ -393,6 +404,7 @@ def index( self.spacegroup, self.distance, self.center, + self.format, phi, resolution, spot_profile, From 97b944a721bf94bf29af0013ccfd1bb330fe7347 Mon Sep 17 00:00:00 2001 From: Doeke Hekstra Date: Mon, 25 Sep 2023 22:44:57 -0400 Subject: [PATCH 2/2] further use of format flags --- cog/commands/calibrate.py | 5 ++++- cog/commands/refine.py | 5 ++++- cog/commands/softlimits.py | 5 ++++- cog/core/experiment.py | 5 +++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cog/commands/calibrate.py b/cog/commands/calibrate.py index 5c47b3f..e162cec 100644 --- a/cog/commands/calibrate.py +++ b/cog/commands/calibrate.py @@ -8,6 +8,7 @@ def calibrate( phi, geometry, pathToImages, + format="RayonixMX340", resolution=2.0, spot_profile=(6, 4, 4), inpfile="calibrate.inp", @@ -27,6 +28,8 @@ def calibrate( Experimental geometry from which to initialize refinement pathToImages : str Path to directory containing the MCCD images + format : string (optional) + Image format to use by Precognition resolution : float High-resolution limit in angstroms spot_profile : tuple(length, width, sigma-cut) @@ -60,7 +63,7 @@ def calibrate( f"Input\n" f" Crystal 0.05 0.05 0.05 0.05 0.05 0.05 free\n" f" Distance 0.05 free\n" - f" Format RayonixMX340\n" + f" Format {format}\n" f" Resolution {resolution} 100\n" f" Wavelength 1.02 1.18\n" f" Spot {spot_profile[0]} {spot_profile[1]} {spot_profile[2]}\n" diff --git a/cog/commands/refine.py b/cog/commands/refine.py index 9772593..5709c03 100644 --- a/cog/commands/refine.py +++ b/cog/commands/refine.py @@ -9,6 +9,7 @@ def refine( phi, geometry, pathToImages, + format="RayonixMX340", resolution=2.0, spot_profile=(6, 4, 4), inpfile="refine.inp", @@ -28,6 +29,8 @@ def refine( Experimental geometry from which to initialize refinement pathToImages : str Path to directory containing the MCCD images + format : string (optional) + Image format to use by Precognition resolution : float High-resolution limit in angstroms spot_profile : tuple(length, width, sigma-cut) @@ -61,7 +64,7 @@ def refine( f"Input\n" f" Crystal 0.05 0.05 0.05 0.05 0.05 0.05 free\n" f" Distance 0.05 free\n" - f" Format RayonixMX340\n" + f" Format {format}\n" f" Omega 0 0\n" f" prompt off\n" f" result off\n\n" diff --git a/cog/commands/softlimits.py b/cog/commands/softlimits.py index 7febf58..525a695 100644 --- a/cog/commands/softlimits.py +++ b/cog/commands/softlimits.py @@ -8,6 +8,7 @@ def softlimits( spacegroup=None, distance=None, center=None, + format="RayonixMX340", resolution=2.0, spot_profile=(10, 5, 2.0), inpfile="limits.inp", @@ -31,6 +32,8 @@ def softlimits( Detector distance in mm center : tuple(center_x, center_y) Coordinates of beam center in pixels + format : string (optional) + Image format to use by Precognition resolution : float High-resolution limit in angstroms spot_profile : tuple(length, width, sigma-cut) @@ -62,7 +65,7 @@ def softlimits( f" Pixel 0.0886 0.0886\n" f" Omega 0 0\n" f" Goniometer 0 0 0\n" - f" Format RayonixMX340\n" + f" Format {format}\n" f" Image {image}\n" f" Resolution {resolution:.2f} 100\n" f" Wavelength 1.02 1.16\n" diff --git a/cog/core/experiment.py b/cog/core/experiment.py index 15bccae..f38fab2 100644 --- a/cog/core/experiment.py +++ b/cog/core/experiment.py @@ -362,6 +362,7 @@ def softlimits(self, image, resolution=2.0, spot_profile=(10, 5, 2.0)): self.spacegroup, self.distance, self.center, + self.format, resolution, spot_profile, ) @@ -447,7 +448,7 @@ def refine( raise KeyError(f"{image} was not found in image DataFrame") rmsd, numMatched, geom = refine( - image, phi, geometry, self.pathToImages, resolution, spot_profile + image, phi, geometry, self.pathToImages, self.format, resolution, spot_profile ) self.images.loc[image, "geometry"] = geom self.images.loc[image, "rmsd"] = rmsd @@ -478,7 +479,7 @@ def calibrate(self, image, resolution=2.0, spot_profile=(6, 4, 4.0)): raise KeyError(f"{image} was not found in image DataFrame") rmsd, numMatched, geom = calibrate( - image, phi, geometry, self.pathToImages, resolution, spot_profile + image, phi, geometry, self.pathToImages, self.format, resolution, spot_profile ) self.images.loc[image, "geometry"] = geom self.images.loc[image, "rmsd"] = rmsd