Loading .pylintrc +1 −5 Original line number Diff line number Diff line Loading @@ -2,7 +2,3 @@ disable=fixme,C,R max-line-length = 88 No newline at end of file [LOGGING] logging-format-style=new No newline at end of file openflexure_microscope/api/app.py +1 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ root_log.addHandler(fh) access_log.addHandler(afh) # Log server paths being used logging.info("Running with data path {}", OPENFLEXURE_VAR_PATH) logging.info("Running with data path %s", OPENFLEXURE_VAR_PATH) logging.info("Creating app") # Create flask app Loading openflexure_microscope/api/default_extensions/__init__.py +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ def handle_extension_error(extension_name): yield except Exception: # pylint: disable=W0703 logging.error( "Exception loading builtin extension {}: \n{}", "Exception loading builtin extension %s: \n%s", extension_name, traceback.format_exc(), ) Loading openflexure_microscope/api/default_extensions/autofocus.py +4 −6 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ class JPEGSharpnessMonitor: raise e if stop < 1: stop = len(jpeg_times) logging.debug("changing stop to {}", (stop)) logging.debug("changing stop to %s", (stop)) jpeg_times = jpeg_times[start:stop] jpeg_zs = np.interp(jpeg_times, stage_times, stage_zs) return jpeg_times, jpeg_zs, jpeg_sizes[start:stop] Loading Loading @@ -258,13 +258,12 @@ def fast_up_down_up_autofocus( # Ensure the MJPEG stream has started microscope.camera.start_stream_recording() df = dz # TODO: refactor so I actually use dz in the code below! logging.debug("Initial move") if initial_move_up: m.focus_rel(df / 2) m.focus_rel(dz / 2) # move down logging.debug("Move down") i, z = m.focus_rel(-df) i, z = m.focus_rel(-dz) # now inspect where the sharpest point is, and estimate the sharpness # (JPEG size) that we should find at the start of the Z stack _, jz, js = m.move_data(i) Loading @@ -285,14 +284,13 @@ def fast_up_down_up_autofocus( inow = np.argmax( js < current_js ) # use the curve we recorded to estimate our position # TODO: fancy interpolation stuff # So, the Z position corresponding to our current sharpness value is zs[inow] # That means we should move forwards, by best_z - zs[inow] logging.debug("Correction move") correction_move = best_z + target_z - jz[inow] logging.debug( "Fast autofocus scan: correcting backlash by moving {} steps", "Fast autofocus scan: correcting backlash by moving %s steps", (correction_move), ) m.focus_rel(correction_move) Loading openflexure_microscope/api/default_extensions/autostorage.py +3 −3 Original line number Diff line number Diff line Loading @@ -95,10 +95,10 @@ class AutostorageExtension(BaseExtension): def on_microscope(self, microscope_obj): """Function to automatically call when the parent LabThing has a microscope attached.""" logging.debug("Autostorage extension found microscope {}", microscope_obj) logging.debug("Autostorage extension found microscope %s", microscope_obj) if hasattr(microscope_obj, "captures"): logging.debug( "Autostorage extension bound to CaptureManager {}", self.capture_manager "Autostorage extension bound to CaptureManager %s", self.capture_manager ) # Store a reference to the CaptureManager Loading @@ -117,7 +117,7 @@ class AutostorageExtension(BaseExtension): # If preferred path does not exist, or cannot be written to if not (os.path.isdir(location) and check_rw(location)): logging.error( "Preferred capture path {} is missing or cannot be written to. Restoring defaults.", "Preferred capture path %s is missing or cannot be written to. Restoring defaults.", location, ) # Reset the storage location to default Loading Loading
.pylintrc +1 −5 Original line number Diff line number Diff line Loading @@ -2,7 +2,3 @@ disable=fixme,C,R max-line-length = 88 No newline at end of file [LOGGING] logging-format-style=new No newline at end of file
openflexure_microscope/api/app.py +1 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ root_log.addHandler(fh) access_log.addHandler(afh) # Log server paths being used logging.info("Running with data path {}", OPENFLEXURE_VAR_PATH) logging.info("Running with data path %s", OPENFLEXURE_VAR_PATH) logging.info("Creating app") # Create flask app Loading
openflexure_microscope/api/default_extensions/__init__.py +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ def handle_extension_error(extension_name): yield except Exception: # pylint: disable=W0703 logging.error( "Exception loading builtin extension {}: \n{}", "Exception loading builtin extension %s: \n%s", extension_name, traceback.format_exc(), ) Loading
openflexure_microscope/api/default_extensions/autofocus.py +4 −6 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ class JPEGSharpnessMonitor: raise e if stop < 1: stop = len(jpeg_times) logging.debug("changing stop to {}", (stop)) logging.debug("changing stop to %s", (stop)) jpeg_times = jpeg_times[start:stop] jpeg_zs = np.interp(jpeg_times, stage_times, stage_zs) return jpeg_times, jpeg_zs, jpeg_sizes[start:stop] Loading Loading @@ -258,13 +258,12 @@ def fast_up_down_up_autofocus( # Ensure the MJPEG stream has started microscope.camera.start_stream_recording() df = dz # TODO: refactor so I actually use dz in the code below! logging.debug("Initial move") if initial_move_up: m.focus_rel(df / 2) m.focus_rel(dz / 2) # move down logging.debug("Move down") i, z = m.focus_rel(-df) i, z = m.focus_rel(-dz) # now inspect where the sharpest point is, and estimate the sharpness # (JPEG size) that we should find at the start of the Z stack _, jz, js = m.move_data(i) Loading @@ -285,14 +284,13 @@ def fast_up_down_up_autofocus( inow = np.argmax( js < current_js ) # use the curve we recorded to estimate our position # TODO: fancy interpolation stuff # So, the Z position corresponding to our current sharpness value is zs[inow] # That means we should move forwards, by best_z - zs[inow] logging.debug("Correction move") correction_move = best_z + target_z - jz[inow] logging.debug( "Fast autofocus scan: correcting backlash by moving {} steps", "Fast autofocus scan: correcting backlash by moving %s steps", (correction_move), ) m.focus_rel(correction_move) Loading
openflexure_microscope/api/default_extensions/autostorage.py +3 −3 Original line number Diff line number Diff line Loading @@ -95,10 +95,10 @@ class AutostorageExtension(BaseExtension): def on_microscope(self, microscope_obj): """Function to automatically call when the parent LabThing has a microscope attached.""" logging.debug("Autostorage extension found microscope {}", microscope_obj) logging.debug("Autostorage extension found microscope %s", microscope_obj) if hasattr(microscope_obj, "captures"): logging.debug( "Autostorage extension bound to CaptureManager {}", self.capture_manager "Autostorage extension bound to CaptureManager %s", self.capture_manager ) # Store a reference to the CaptureManager Loading @@ -117,7 +117,7 @@ class AutostorageExtension(BaseExtension): # If preferred path does not exist, or cannot be written to if not (os.path.isdir(location) and check_rw(location)): logging.error( "Preferred capture path {} is missing or cannot be written to. Restoring defaults.", "Preferred capture path %s is missing or cannot be written to. Restoring defaults.", location, ) # Reset the storage location to default Loading