From fd0cbe751d10154adce85ad0b368236181b1040b Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 08:39:57 +0200 Subject: [PATCH 01/19] Add `get_movie` api to TEMController for gapless acquisition --- instamatic/TEMController/TEMController.py | 45 +++++++++++++++++++++++ instamatic/camera/camera_simu.py | 30 +++++++++++++-- 2 files changed, 72 insertions(+), 3 deletions(-) diff --git a/instamatic/TEMController/TEMController.py b/instamatic/TEMController/TEMController.py index 54099d43..60fe2eca 100644 --- a/instamatic/TEMController/TEMController.py +++ b/instamatic/TEMController/TEMController.py @@ -660,6 +660,51 @@ def get_image(self, return arr, h + def get_movie(self, + n_frames: int, + *, + exposure: float = None, + binsize: int = None, + out: str = None) -> Tuple[np.ndarray]: + """Collect a stack of images using the camera's movie mode, if + available. + + This minimizes the gap between frames. + + Parameters + ---------- + n_frames : int + Number of frames to collect + exposure : float, optional + Exposure time in seconds + binsize : int, optional + Binning to use for the image, must be 1, 2, or 4, etc + out : str, optional + Path or filename to which the image/header is saved (defaults to tiff) + + Returns + ------- + stack : Tuple[np.ndarray] + List of numpy arrays with image data. + """ + if not self.cam: + raise AttributeError(f"{self.__class__.__name__} object has no attribute 'cam' (Camera has not been initialized)") + + if not binsize: + binsize = self.cam.default_binsize + if not exposure: + exposure = self.cam.default_exposure + + if self.autoblank: + self.beam.unblank() + + stack = self.cam.getMovie(n_frames=n_frames, exposure=exposure, binsize=binsize) + + if self.autoblank: + self.beam.blank() + + return stack + def store_diff_beam(self, name: str = 'beam', save_to_file: bool = False): """Record alignment for current diffraction beam. Stores Guntilt (for dose control), diffraction focus, spot size, brightness, and the diff --git a/instamatic/camera/camera_simu.py b/instamatic/camera/camera_simu.py index 6dc72573..c1aba801 100644 --- a/instamatic/camera/camera_simu.py +++ b/instamatic/camera/camera_simu.py @@ -46,12 +46,17 @@ def getImage(self, exposure=None, binsize=None, **kwargs) -> np.ndarray: """Image acquisition routine. If the exposure and binsize are not given, the default values are read from the config file. - exposure: + Parameters + ---------- + exposure : float Exposure time in seconds. - binsize: + binsize : int Which binning to use. - """ + Returns + ------- + arr : np.ndarray + """ if exposure is None: exposure = self.default_exposure if not binsize: @@ -68,6 +73,25 @@ def getImage(self, exposure=None, binsize=None, **kwargs) -> np.ndarray: return arr + def getMovie(self, n_frames, *, exposure: float = None, binsize: int = None, **kwargs): + """"Movie acquisition routine. If the exposure and binsize are not + given, the default values are read from the config file. + + Parameters + ---------- + n_frames : int + Number of frames to collect + exposure : float + Exposure time in seconds. + binsize : int + Which binning to use. + + Returns + ------- + stack : List[np.ndarray] + """ + return [self.getImage(exposure=exposure, binsize=binsize) for _ in range(n_frames)] + def acquireImage(self) -> int: """For TVIPS compatibility.""" return 1 From fcf31b19debda5ae9d39d579170ccb94bdb9f2cc Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 08:50:29 +0200 Subject: [PATCH 02/19] Update defaults for merlin and update docs Add docstrings --- docs/merlin.md | 18 ++++++++----- instamatic/camera/camera_merlin.py | 38 +++++++++++++++++++++++++++- instamatic/config/camera/merlin.yaml | 5 ++-- 3 files changed, 51 insertions(+), 10 deletions(-) diff --git a/docs/merlin.md b/docs/merlin.md index cdcdc87d..4babef53 100644 --- a/docs/merlin.md +++ b/docs/merlin.md @@ -34,18 +34,24 @@ host: '10.0.0.123' **detector_config** : The parameters under `detector_config` are directly sent to the Merlin software when instamatic starts. -These can be used to put the Merlin in the desired state for data acquisition. Check the Merlin documention for more information. +These can be used to put the Merlin in the desired state for data acquisition. Any command with a `SET` type can be adjusted. Check the Merlin EM documention for more information. + +: The default sets continuous read-write mode and 12-bit mode to minimize the gap between frames. It also disables automatic file writing (`FILEENABLE`) and image processing by Merlin, and enables headless `RUNHEADLESS` mode for faster throughput. If you don't want this, you can delete these lines or modify them. -: For example: +```yaml +detector_config: + CONTINUOUSRW: 1 + COUNTERDEPTH: 12 + FILEENABLE: 0 + RUNHEADLESS: 1 +``` + +: You could for example also set the thresholds and bias in the instamatic config by adding these lines: ```yaml detector_config: THRESHOLD0: 120 THRESHOLD1: 40 HVBIAS: 511 - COUNTERDEPTH: 12 - FILEENABLE: 0 - CONTINUOUSRW: 1 - RUNHEADLESS: 0 ``` ## Notes on using instamatic with Merlin diff --git a/instamatic/camera/camera_merlin.py b/instamatic/camera/camera_merlin.py index 9fe93c74..e4ef4ad2 100644 --- a/instamatic/camera/camera_merlin.py +++ b/instamatic/camera/camera_merlin.py @@ -1,3 +1,28 @@ +"""Camera module for connecting with the Merlin EM detector. + +The module communicates over TCP/IP with the camera. + +Example usage: + +``` +# initialize +cam = CameraMerlin() + +# get values +cam.merlin_get('DETECTORSTATUS') + +# set continuous read/write mode +cam.merlin_set('CONTINUOUSRW', 1) +cam.merlin_set('COUNTERDEPTH', 12) + +# acquire single frame (uses soft trigger) +frame = cam.getImage(exposure=0.1) + +# acquire multiple frames with gapless acquisition +frames = cam.getMovie(n_frames=10, exposure=0.1) +``` +""" + import atexit import logging import socket @@ -134,7 +159,18 @@ def merlin_get(self, key: str) -> str: return value def merlin_cmd(self, key: str): - """Send Merlin command through command socket.""" + """Send Merlin command through command socket. + + Parameters + ---------- + key : str + Name of the command + + Raises + ------ + ValueError + If the command failed + """ self.s_cmd.sendall(MPX_CMD('CMD', key)) response = self.s_cmd.recv(1024).decode() logger.debug(response) diff --git a/instamatic/config/camera/merlin.yaml b/instamatic/config/camera/merlin.yaml index 47270e8f..5721c4c8 100644 --- a/instamatic/config/camera/merlin.yaml +++ b/instamatic/config/camera/merlin.yaml @@ -9,11 +9,10 @@ possible_binsizes: [1] stretch_amplitude: 0.0 stretch_azimuth: 0.0 detector_config: - THRESHOLD0: 120 - THRESHOLD1: 40 - HVBIAS: 511 + CONTINUOUSRW: 1 COUNTERDEPTH: 12 FILEENABLE: 0 + RUNHEADLESS: 1 # server hostname or IP address and port used to send commands host: '127.0.0.1' commandport: 6341 From 57ca6e91ebc627fd19188b3195bf98b2a97e1685 Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 09:12:10 +0200 Subject: [PATCH 03/19] Update packaging to pyproject.toml --- pyproject.toml | 120 ++++++++++++++++++++++++++++++++++++++++++++++++- setup.cfg | 118 ------------------------------------------------ setup.py | 3 -- setup_win.bat | 3 -- 4 files changed, 119 insertions(+), 125 deletions(-) delete mode 100644 setup.cfg delete mode 100644 setup.py delete mode 100644 setup_win.bat diff --git a/pyproject.toml b/pyproject.toml index 78516176..2f846fa2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,125 @@ [build-system] -requires = ["setuptools>=40.6.0", "wheel"] +requires = ["setuptools>=61.2"] build-backend = "setuptools.build_meta" +# https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ +[project] +name = "instamatic" +version = "1.10.0" +description = "Python program for automated electron diffraction data collection" +readme = "README.md" +requires-python = ">=3.7" +authors = [ + {name = "Stef Smeets", email = "s.smeets@esciencecenter.nl"}, +] +keywords = [ + "electron-crystallography", + "electron-microscopy", + "electron-diffraction", + "serial-crystallography", + "3D-electron-diffraction", + "micro-ed", + "data-collection", + "automation", +] +license = {text = "BSD License"} +classifiers = [ + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Operating System :: Microsoft :: Windows", + "Topic :: Scientific/Engineering :: Human Machine Interfaces", + "Topic :: Scientific/Engineering :: Chemistry", + "Topic :: Software Development :: Libraries", +] +dependencies = [ + "comtypes >= 1.1.7", + "h5py >= 2.10.0", + "ipython >= 7.11.1", + "lmfit >= 1.0.0", + "matplotlib >= 3.1.2", + "mrcfile >= 1.1.2", + "numpy >= 1.17.3", + "pandas >= 1.0.0", + "pillow >= 7.0.0", + "pywinauto >= 0.6.8", + "pyyaml >= 5.3", + "scikit-image >= 0.17.1", + "scipy >= 1.3.2", + "tifffile >= 2019.7.26.2", + "tqdm >= 4.41.1", + "virtualbox >= 2.0.0", + "pyserialem >= 0.3.2", +] + +[project.urls] +homepage = "https://github.com/instamatic-dev/instamatic" +issues = "http://github.com/instamatic-dev/instamatic/issues" +documentation = "https://instamatic.readthedocs.io" +changelog = "https://github.com/instamatic-dev/instamatic/releases" + +[project.optional-dependencies] +develop = [ + "bump2version", + "check-manifest", + "pre-commit", + "pytest >= 5.4.1", + "coverage", +] +serval = [ + "serval-toolkit" +] +docs = [ + "markdown-include", + "mkdocs", + "mkdocs-jupyter", + "mkdocs-gen-files", + "mkdocs-material", + "mkdocstrings[python]", +] +publishing = [ + "twine", + "wheel", + "build", +] + +[project.scripts] +"instamatic" = "instamatic.main:main" +"instamatic.controller" = "instamatic.TEMController.TEMController:main_entry" +# experiments +"instamatic.serialed" = "instamatic.experiments.serialed.experiment:main" +"instamatic.camera" = "instamatic.camera.camera:main_entry" +# calibrate +"instamatic.calibrate_stage_lowmag" = "instamatic.calibrate.calibrate_stage_lowmag:main_entry" +"instamatic.calibrate_stage_mag1" = "instamatic.calibrate.calibrate_stage_mag1:main_entry" +"instamatic.calibrate_beamshift" = "instamatic.calibrate.calibrate_beamshift:main_entry" +"instamatic.calibrate_directbeam" = "instamatic.calibrate.calibrate_directbeam:main_entry" +"instamatic.calibrate_stagematrix" = "instamatic.calibrate.calibrate_stagematrix:main_entry" +"instamatic.flatfield" = "instamatic.processing.flatfield:main_entry" +"instamatic.stretch_correction" = "instamatic.processing.stretch_correction:main_entry" +# tools +"instamatic.browser" = "scripts.browser:main" +"instamatic.viewer" = "scripts.viewer:main" +"instamatic.defocus_helper" = "instamatic.gui.defocus_button:main" +"instamatic.find_crystals" = "instamatic.processing.find_crystals:main_entry" +"instamatic.find_crystals_ilastik" = "instamatic.processing.find_crystals_ilastik:main_entry" +"instamatic.learn" = "scripts.learn:main_entry" +# server +"instamatic.temserver" = "instamatic.server.tem_server:main" +"instamatic.camserver" = "instamatic.server.cam_server:main" +"instamatic.dialsserver" = "instamatic.server.dials_server:main" +"instamatic.VMserver" = "instamatic.server.vm_ubuntu_server:main" +"instamatic.xdsserver" = "instamatic.server.xds_server:main" +"instamatic.temserver_fei" = "instamatic.server.TEMServer_FEI:main" +"instamatic.goniotoolserver" = "instamatic.server.goniotool_server:main" +# setup +"instamatic.autoconfig" = "instamatic.config.autoconfig:main" + [tool.ruff] # Enable Pyflakes `E` and `F` codes by default. select = [ diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index a958b753..00000000 --- a/setup.cfg +++ /dev/null @@ -1,118 +0,0 @@ -# see documentation, e.g. -# - https://packaging.python.org/tutorials/packaging-projects/#configuring-metadata -# - https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html -# - https://www.python.org/dev/peps/pep-0314/ - -[metadata] -author = Stef Smeets -author_email = s.smeets@esciencecenter.nl -classifiers = - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Development Status :: 5 - Production/Stable - Intended Audience :: Science/Research - License :: OSI Approved :: BSD License - Operating System :: Microsoft :: Windows - Topic :: Scientific/Engineering :: Human Machine Interfaces - Topic :: Scientific/Engineering :: Chemistry - Topic :: Software Development :: Libraries -description = Python program for automated electron diffraction data collection -keywords = - electron-crystallography - electron-microscopy - electron-diffraction - serial-crystallography - 3D-electron-diffraction - micro-ed - data-collection - automation -long_description = file: README.md -long_description_content_type = text/markdown -name = instamatic -project_urls = - Bug Tracker = http://github.com/instamatic-dev/instamatic/issues - Documentation = https://instamatic.readthedocs.io/ -url = http://github.com/instamatic-dev/instamatic -version = 1.10.0 - - -[options] -zip_safe = False -include_package_data = True -packages = find: -install_requires = - comtypes >= 1.1.7 - h5py >= 2.10.0 - ipython >= 7.11.1 - lmfit >= 1.0.0 - matplotlib >= 3.1.2 - mrcfile >= 1.1.2 - numpy >= 1.17.3 - pandas >= 1.0.0 - pillow >= 7.0.0 - pywinauto >= 0.6.8 - pyyaml >= 5.3 - scikit-image >= 0.17.1 - scipy >= 1.3.2 - tifffile >= 2019.7.26.2 - tqdm >= 4.41.1 - virtualbox >= 2.0.0 - pyserialem >= 0.3.2 - - -[options.extras_require] -develop = - bump2version - check-manifest - pre-commit - pytest >= 5.4.1 - coverage -serval = - serval-toolkit -docs = - markdown-include - mkdocs - mkdocs-jupyter - mkdocs-gen-files - mkdocs-material - mkdocstrings[python] - - -[options.packages.find] -include = instamatic, instamatic.*, instamatic.experiments.* - -[options.entry_points] -console_scripts = - instamatic = instamatic.main:main - instamatic.controller = instamatic.TEMController.TEMController:main_entry - # experiments - instamatic.serialed = instamatic.experiments.serialed.experiment:main - instamatic.camera = instamatic.camera.camera:main_entry - # calibrate - instamatic.calibrate_stage_lowmag = instamatic.calibrate.calibrate_stage_lowmag:main_entry - instamatic.calibrate_stage_mag1 = instamatic.calibrate.calibrate_stage_mag1:main_entry - instamatic.calibrate_beamshift = instamatic.calibrate.calibrate_beamshift:main_entry - instamatic.calibrate_directbeam = instamatic.calibrate.calibrate_directbeam:main_entry - instamatic.calibrate_stagematrix = instamatic.calibrate.calibrate_stagematrix:main_entry - instamatic.flatfield = instamatic.processing.flatfield:main_entry - instamatic.stretch_correction = instamatic.processing.stretch_correction:main_entry - # tools - instamatic.browser = scripts.browser:main - instamatic.viewer = scripts.viewer:main - instamatic.defocus_helper = instamatic.gui.defocus_button:main - instamatic.find_crystals = instamatic.processing.find_crystals:main_entry - instamatic.find_crystals_ilastik = instamatic.processing.find_crystals_ilastik:main_entry - instamatic.learn = scripts.learn:main_entry - # server - instamatic.temserver = instamatic.server.tem_server:main - instamatic.camserver = instamatic.server.cam_server:main - instamatic.dialsserver = instamatic.server.dials_server:main - instamatic.VMserver = instamatic.server.vm_ubuntu_server:main - instamatic.xdsserver = instamatic.server.xds_server:main - instamatic.temserver_fei = instamatic.server.TEMServer_FEI:main - instamatic.goniotoolserver = instamatic.server.goniotool_server:main - # setup - instamatic.autoconfig = instamatic.config.autoconfig:main diff --git a/setup.py b/setup.py deleted file mode 100644 index 60684932..00000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() diff --git a/setup_win.bat b/setup_win.bat deleted file mode 100644 index d45b8df4..00000000 --- a/setup_win.bat +++ /dev/null @@ -1,3 +0,0 @@ -@setlocal -@python setup.py install -pause From d819d70ee643cd11c66d7036d911384593410156 Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 09:26:54 +0200 Subject: [PATCH 04/19] Move to src layout --- MANIFEST.in | 28 +++++++++--------- .../TEMController/TEMController.py | 0 .../instamatic}/TEMController/__init__.py | 0 .../instamatic}/TEMController/deflectors.py | 0 .../TEMController/fei_microscope.py | 0 .../TEMController/fei_simu_microscope.py | 0 .../TEMController/jeol_microscope.py | 0 .../instamatic}/TEMController/lenses.py | 0 .../instamatic}/TEMController/microscope.py | 0 .../TEMController/microscope_client.py | 0 .../TEMController/simu_microscope.py | 0 .../instamatic}/TEMController/stage.py | 0 .../instamatic}/TEMController/states.py | 0 {instamatic => src/instamatic}/__init__.py | 0 .../instamatic}/acquire_at_items.py | 0 {instamatic => src/instamatic}/admin.py | 0 {instamatic => src/instamatic}/banner.py | 0 {instamatic => src/instamatic}/browser.py | 0 .../instamatic}/calibrate/__init__.py | 0 .../calibrate/calibrate_beamshift.py | 0 .../calibrate/calibrate_brightness.py | 0 .../calibrate/calibrate_directbeam.py | 0 .../calibrate/calibrate_imageshift12.py | 0 .../calibrate/calibrate_stage_lowmag.py | 0 .../calibrate/calibrate_stage_mag1.py | 0 .../calibrate/calibrate_stagematrix.py | 0 .../instamatic}/calibrate/center_z.py | 0 .../instamatic}/calibrate/filenames.py | 0 .../instamatic}/calibrate/fit.py | 0 .../instamatic}/camera/CCDCOM.h | 0 .../instamatic}/camera/CCDCOM2_x64_gatan.dll | Bin .../camera/CCDCOM2_x64_simulation.dll | Bin .../instamatic}/camera/CCDCOM2_x86_gatan.dll | Bin .../camera/CCDCOM2_x86_simulation.dll | Bin .../instamatic}/camera/EMCameraObj.dll | Bin .../instamatic}/camera/__init__.py | 0 .../instamatic}/camera/camera.py | 0 .../instamatic}/camera/camera_client.py | 0 .../instamatic}/camera/camera_emmenu.py | 0 .../instamatic}/camera/camera_gatan.py | 0 .../instamatic}/camera/camera_gatan2.py | 0 .../instamatic}/camera/camera_merlin.py | 0 .../instamatic}/camera/camera_serval.py | 0 .../instamatic}/camera/camera_simu.py | 0 .../instamatic}/camera/camera_timepix.py | 0 .../instamatic}/camera/fakevideostream.py | 0 .../instamatic}/camera/gatansocket3.md | 0 .../instamatic}/camera/gatansocket3.py | 0 .../instamatic}/camera/merlin_io.py | 0 .../instamatic}/camera/mpxhwrelaxd.dll | Bin .../instamatic}/camera/timepix.lockfile | 0 .../camera/tpx/171207_with_flatfield.bpc | 0 .../camera/tpx/171207_with_flatfield.bpc.dacs | 0 .../instamatic}/camera/tpx/HW.dacs | 0 .../instamatic}/camera/tpx/config.txt | 0 .../instamatic}/camera/videostream.py | 0 .../instamatic}/config/__init__.py | 0 .../config/alignments/neutral.yaml | 0 .../instamatic}/config/autoconfig.py | 0 .../instamatic}/config/calibration/orius.yaml | 0 .../config/calibration/simulate.yaml | 0 .../config/calibration/timepix.yaml | 0 .../config/calibration/tvips-f416.yaml | 0 .../instamatic}/config/camera/merlin.yaml | 0 .../instamatic}/config/camera/orius.yaml | 0 .../instamatic}/config/camera/serval.yaml | 0 .../instamatic}/config/camera/simulate.yaml | 0 .../config/camera/simulateDLL.yaml | 0 .../instamatic}/config/camera/timepix.yaml | 0 .../instamatic}/config/camera/tvips-f416.yaml | 0 .../config/camera/tvips-xf416.yaml | 0 .../instamatic}/config/config_updater.py | 0 .../instamatic}/config/defaults.yaml | 0 .../config/microscope/fei_simu.yaml | 0 .../config/microscope/fei_themisZ.yaml | 0 .../config/microscope/jeol-1400.yaml | 0 .../instamatic}/config/microscope/jeol.yaml | 0 .../config/microscope/simulate.yaml | 0 .../instamatic}/config/scripts/close_down.py | 0 .../instamatic}/config/scripts/focus_mode.py | 0 .../instamatic}/config/scripts/hello_world.py | 0 .../instamatic}/config/scripts/readme.md | 0 .../instamatic}/config/scripts/search_mode.py | 0 .../instamatic}/config/settings.yaml | 0 .../instamatic}/config/utils.py | 0 {instamatic => src/instamatic}/exceptions.py | 0 .../instamatic}/experiments/__init__.py | 0 .../experiments/autocred/__init__.py | 0 .../experiments/autocred/experiment.py | 0 .../instamatic}/experiments/cred/__init__.py | 0 .../experiments/cred/experiment.py | 0 .../experiments/cred_gatan/__init__.py | 0 .../experiments/cred_gatan/experiment.py | 0 .../experiments/cred_tvips/__init__.py | 0 .../experiments/cred_tvips/experiment.py | 0 .../instamatic}/experiments/red/__init__.py | 0 .../instamatic}/experiments/red/experiment.py | 0 .../experiments/serialed/__init__.py | 0 .../experiments/serialed/experiment.py | 0 .../instamatic}/formats/__init__.py | 0 .../instamatic}/formats/adscimage.py | 0 .../instamatic}/formats/csvIO.py | 0 {instamatic => src/instamatic}/formats/mrc.py | 0 .../instamatic}/formats/util.py | 0 .../instamatic}/formats/xdscbf.py | 0 {instamatic => src/instamatic}/goniotool.py | 0 {instamatic => src/instamatic}/gridmontage.py | 0 .../instamatic}/gui/__init__.py | 0 .../instamatic}/gui/about_frame.py | 0 .../instamatic}/gui/autocred_frame.py | 0 .../instamatic}/gui/base_module.py | 0 .../instamatic}/gui/console_frame.py | 0 .../instamatic}/gui/cred_fei_frame.py | 0 .../instamatic}/gui/cred_frame.py | 0 .../instamatic}/gui/cred_tvips_frame.py | 0 .../instamatic}/gui/ctrl_frame.py | 0 .../instamatic}/gui/debug_frame.py | 0 .../instamatic}/gui/defocus_button.py | 0 {instamatic => src/instamatic}/gui/gui.py | 0 .../instamatic}/gui/io_frame.py | 0 {instamatic => src/instamatic}/gui/jobs.py | 0 .../instamatic}/gui/machine_learning_frame.py | 0 {instamatic => src/instamatic}/gui/modules.py | 0 .../instamatic}/gui/mpl_frame.py | 0 .../instamatic}/gui/red_frame.py | 0 .../instamatic}/gui/sed_frame.py | 0 .../instamatic}/gui/videostream_frame.py | 0 {instamatic => src/instamatic}/image_utils.py | 0 {instamatic => src/instamatic}/imreg.py | 0 {instamatic => src/instamatic}/io.py | 0 {instamatic => src/instamatic}/main.py | 0 {instamatic => src/instamatic}/montage.py | 0 .../instamatic}/neural_network/__init__.py | 0 .../neural_network/neural_network.py | 0 .../instamatic}/neural_network/preprocess.py | 0 .../neural_network/preprocess_SerialRED.py | 0 .../instamatic}/neural_network/weights-py2.p | Bin .../instamatic}/neural_network/weights-py3.p | Bin .../instamatic}/processing/ImgConversion.py | 0 .../instamatic}/processing/ImgConversionDM.py | 0 .../processing/ImgConversionTPX.py | 0 .../processing/ImgConversionTVIPS.py | 0 .../instamatic}/processing/XDS_template.py | 0 .../instamatic}/processing/XDS_templateDM.py | 0 .../instamatic}/processing/XDS_templateTPX.py | 0 .../processing/XDS_templateTVIPS.py | 0 .../instamatic}/processing/__init__.py | 0 .../instamatic}/processing/find_crystals.py | 0 .../processing/find_crystals_ilastik.py | 0 .../instamatic}/processing/find_holes.py | 0 .../instamatic}/processing/flatfield.py | 0 .../processing/stretch_correction.py | 0 .../instamatic}/server/TEMServer_FEI.py | 0 .../instamatic}/server/__init__.py | 0 .../instamatic}/server/cam_client.py | 0 .../instamatic}/server/cam_server.py | 0 .../instamatic}/server/dials_server.py | 0 .../instamatic}/server/goniotool_server.py | 0 .../instamatic}/server/serializer.py | 0 .../instamatic}/server/tem_client.py | 0 .../instamatic}/server/tem_server.py | 0 .../instamatic}/server/vm_ubuntu_server.py | 0 .../instamatic}/server/xds_server.py | 0 {instamatic => src/instamatic}/tools.py | 0 .../instamatic}/utils/__init__.py | 0 .../instamatic}/utils/beamstop.py | 0 .../utils/high_precision_timers.py | 0 .../instamatic}/utils/progress.py | 0 .../instamatic}/utils/singleton.py | 0 .../instamatic}/utils/spinbox.py | 0 .../instamatic}/utils/xds_parser.py | 0 171 files changed, 14 insertions(+), 14 deletions(-) rename {instamatic => src/instamatic}/TEMController/TEMController.py (100%) rename {instamatic => src/instamatic}/TEMController/__init__.py (100%) rename {instamatic => src/instamatic}/TEMController/deflectors.py (100%) rename {instamatic => src/instamatic}/TEMController/fei_microscope.py (100%) rename {instamatic => src/instamatic}/TEMController/fei_simu_microscope.py (100%) rename {instamatic => src/instamatic}/TEMController/jeol_microscope.py (100%) rename {instamatic => src/instamatic}/TEMController/lenses.py (100%) rename {instamatic => src/instamatic}/TEMController/microscope.py (100%) rename {instamatic => src/instamatic}/TEMController/microscope_client.py (100%) rename {instamatic => src/instamatic}/TEMController/simu_microscope.py (100%) rename {instamatic => src/instamatic}/TEMController/stage.py (100%) rename {instamatic => src/instamatic}/TEMController/states.py (100%) rename {instamatic => src/instamatic}/__init__.py (100%) rename {instamatic => src/instamatic}/acquire_at_items.py (100%) rename {instamatic => src/instamatic}/admin.py (100%) rename {instamatic => src/instamatic}/banner.py (100%) rename {instamatic => src/instamatic}/browser.py (100%) rename {instamatic => src/instamatic}/calibrate/__init__.py (100%) rename {instamatic => src/instamatic}/calibrate/calibrate_beamshift.py (100%) rename {instamatic => src/instamatic}/calibrate/calibrate_brightness.py (100%) rename {instamatic => src/instamatic}/calibrate/calibrate_directbeam.py (100%) rename {instamatic => src/instamatic}/calibrate/calibrate_imageshift12.py (100%) rename {instamatic => src/instamatic}/calibrate/calibrate_stage_lowmag.py (100%) rename {instamatic => src/instamatic}/calibrate/calibrate_stage_mag1.py (100%) rename {instamatic => src/instamatic}/calibrate/calibrate_stagematrix.py (100%) rename {instamatic => src/instamatic}/calibrate/center_z.py (100%) rename {instamatic => src/instamatic}/calibrate/filenames.py (100%) rename {instamatic => src/instamatic}/calibrate/fit.py (100%) rename {instamatic => src/instamatic}/camera/CCDCOM.h (100%) rename {instamatic => src/instamatic}/camera/CCDCOM2_x64_gatan.dll (100%) rename {instamatic => src/instamatic}/camera/CCDCOM2_x64_simulation.dll (100%) rename {instamatic => src/instamatic}/camera/CCDCOM2_x86_gatan.dll (100%) rename {instamatic => src/instamatic}/camera/CCDCOM2_x86_simulation.dll (100%) rename {instamatic => src/instamatic}/camera/EMCameraObj.dll (100%) rename {instamatic => src/instamatic}/camera/__init__.py (100%) rename {instamatic => src/instamatic}/camera/camera.py (100%) rename {instamatic => src/instamatic}/camera/camera_client.py (100%) rename {instamatic => src/instamatic}/camera/camera_emmenu.py (100%) rename {instamatic => src/instamatic}/camera/camera_gatan.py (100%) rename {instamatic => src/instamatic}/camera/camera_gatan2.py (100%) rename {instamatic => src/instamatic}/camera/camera_merlin.py (100%) rename {instamatic => src/instamatic}/camera/camera_serval.py (100%) rename {instamatic => src/instamatic}/camera/camera_simu.py (100%) rename {instamatic => src/instamatic}/camera/camera_timepix.py (100%) rename {instamatic => src/instamatic}/camera/fakevideostream.py (100%) rename {instamatic => src/instamatic}/camera/gatansocket3.md (100%) rename {instamatic => src/instamatic}/camera/gatansocket3.py (100%) rename {instamatic => src/instamatic}/camera/merlin_io.py (100%) rename {instamatic => src/instamatic}/camera/mpxhwrelaxd.dll (100%) rename {instamatic => src/instamatic}/camera/timepix.lockfile (100%) rename {instamatic => src/instamatic}/camera/tpx/171207_with_flatfield.bpc (100%) rename {instamatic => src/instamatic}/camera/tpx/171207_with_flatfield.bpc.dacs (100%) rename {instamatic => src/instamatic}/camera/tpx/HW.dacs (100%) rename {instamatic => src/instamatic}/camera/tpx/config.txt (100%) rename {instamatic => src/instamatic}/camera/videostream.py (100%) rename {instamatic => src/instamatic}/config/__init__.py (100%) rename {instamatic => src/instamatic}/config/alignments/neutral.yaml (100%) rename {instamatic => src/instamatic}/config/autoconfig.py (100%) rename {instamatic => src/instamatic}/config/calibration/orius.yaml (100%) rename {instamatic => src/instamatic}/config/calibration/simulate.yaml (100%) rename {instamatic => src/instamatic}/config/calibration/timepix.yaml (100%) rename {instamatic => src/instamatic}/config/calibration/tvips-f416.yaml (100%) rename {instamatic => src/instamatic}/config/camera/merlin.yaml (100%) rename {instamatic => src/instamatic}/config/camera/orius.yaml (100%) rename {instamatic => src/instamatic}/config/camera/serval.yaml (100%) rename {instamatic => src/instamatic}/config/camera/simulate.yaml (100%) rename {instamatic => src/instamatic}/config/camera/simulateDLL.yaml (100%) rename {instamatic => src/instamatic}/config/camera/timepix.yaml (100%) rename {instamatic => src/instamatic}/config/camera/tvips-f416.yaml (100%) rename {instamatic => src/instamatic}/config/camera/tvips-xf416.yaml (100%) rename {instamatic => src/instamatic}/config/config_updater.py (100%) rename {instamatic => src/instamatic}/config/defaults.yaml (100%) rename {instamatic => src/instamatic}/config/microscope/fei_simu.yaml (100%) rename {instamatic => src/instamatic}/config/microscope/fei_themisZ.yaml (100%) rename {instamatic => src/instamatic}/config/microscope/jeol-1400.yaml (100%) rename {instamatic => src/instamatic}/config/microscope/jeol.yaml (100%) rename {instamatic => src/instamatic}/config/microscope/simulate.yaml (100%) rename {instamatic => src/instamatic}/config/scripts/close_down.py (100%) rename {instamatic => src/instamatic}/config/scripts/focus_mode.py (100%) rename {instamatic => src/instamatic}/config/scripts/hello_world.py (100%) rename {instamatic => src/instamatic}/config/scripts/readme.md (100%) rename {instamatic => src/instamatic}/config/scripts/search_mode.py (100%) rename {instamatic => src/instamatic}/config/settings.yaml (100%) rename {instamatic => src/instamatic}/config/utils.py (100%) rename {instamatic => src/instamatic}/exceptions.py (100%) rename {instamatic => src/instamatic}/experiments/__init__.py (100%) rename {instamatic => src/instamatic}/experiments/autocred/__init__.py (100%) rename {instamatic => src/instamatic}/experiments/autocred/experiment.py (100%) rename {instamatic => src/instamatic}/experiments/cred/__init__.py (100%) rename {instamatic => src/instamatic}/experiments/cred/experiment.py (100%) rename {instamatic => src/instamatic}/experiments/cred_gatan/__init__.py (100%) rename {instamatic => src/instamatic}/experiments/cred_gatan/experiment.py (100%) rename {instamatic => src/instamatic}/experiments/cred_tvips/__init__.py (100%) rename {instamatic => src/instamatic}/experiments/cred_tvips/experiment.py (100%) rename {instamatic => src/instamatic}/experiments/red/__init__.py (100%) rename {instamatic => src/instamatic}/experiments/red/experiment.py (100%) rename {instamatic => src/instamatic}/experiments/serialed/__init__.py (100%) rename {instamatic => src/instamatic}/experiments/serialed/experiment.py (100%) rename {instamatic => src/instamatic}/formats/__init__.py (100%) rename {instamatic => src/instamatic}/formats/adscimage.py (100%) rename {instamatic => src/instamatic}/formats/csvIO.py (100%) rename {instamatic => src/instamatic}/formats/mrc.py (100%) rename {instamatic => src/instamatic}/formats/util.py (100%) rename {instamatic => src/instamatic}/formats/xdscbf.py (100%) rename {instamatic => src/instamatic}/goniotool.py (100%) rename {instamatic => src/instamatic}/gridmontage.py (100%) rename {instamatic => src/instamatic}/gui/__init__.py (100%) rename {instamatic => src/instamatic}/gui/about_frame.py (100%) rename {instamatic => src/instamatic}/gui/autocred_frame.py (100%) rename {instamatic => src/instamatic}/gui/base_module.py (100%) rename {instamatic => src/instamatic}/gui/console_frame.py (100%) rename {instamatic => src/instamatic}/gui/cred_fei_frame.py (100%) rename {instamatic => src/instamatic}/gui/cred_frame.py (100%) rename {instamatic => src/instamatic}/gui/cred_tvips_frame.py (100%) rename {instamatic => src/instamatic}/gui/ctrl_frame.py (100%) rename {instamatic => src/instamatic}/gui/debug_frame.py (100%) rename {instamatic => src/instamatic}/gui/defocus_button.py (100%) rename {instamatic => src/instamatic}/gui/gui.py (100%) rename {instamatic => src/instamatic}/gui/io_frame.py (100%) rename {instamatic => src/instamatic}/gui/jobs.py (100%) rename {instamatic => src/instamatic}/gui/machine_learning_frame.py (100%) rename {instamatic => src/instamatic}/gui/modules.py (100%) rename {instamatic => src/instamatic}/gui/mpl_frame.py (100%) rename {instamatic => src/instamatic}/gui/red_frame.py (100%) rename {instamatic => src/instamatic}/gui/sed_frame.py (100%) rename {instamatic => src/instamatic}/gui/videostream_frame.py (100%) rename {instamatic => src/instamatic}/image_utils.py (100%) rename {instamatic => src/instamatic}/imreg.py (100%) rename {instamatic => src/instamatic}/io.py (100%) rename {instamatic => src/instamatic}/main.py (100%) rename {instamatic => src/instamatic}/montage.py (100%) rename {instamatic => src/instamatic}/neural_network/__init__.py (100%) rename {instamatic => src/instamatic}/neural_network/neural_network.py (100%) rename {instamatic => src/instamatic}/neural_network/preprocess.py (100%) rename {instamatic => src/instamatic}/neural_network/preprocess_SerialRED.py (100%) rename {instamatic => src/instamatic}/neural_network/weights-py2.p (100%) rename {instamatic => src/instamatic}/neural_network/weights-py3.p (100%) rename {instamatic => src/instamatic}/processing/ImgConversion.py (100%) rename {instamatic => src/instamatic}/processing/ImgConversionDM.py (100%) rename {instamatic => src/instamatic}/processing/ImgConversionTPX.py (100%) rename {instamatic => src/instamatic}/processing/ImgConversionTVIPS.py (100%) rename {instamatic => src/instamatic}/processing/XDS_template.py (100%) rename {instamatic => src/instamatic}/processing/XDS_templateDM.py (100%) rename {instamatic => src/instamatic}/processing/XDS_templateTPX.py (100%) rename {instamatic => src/instamatic}/processing/XDS_templateTVIPS.py (100%) rename {instamatic => src/instamatic}/processing/__init__.py (100%) rename {instamatic => src/instamatic}/processing/find_crystals.py (100%) rename {instamatic => src/instamatic}/processing/find_crystals_ilastik.py (100%) rename {instamatic => src/instamatic}/processing/find_holes.py (100%) rename {instamatic => src/instamatic}/processing/flatfield.py (100%) rename {instamatic => src/instamatic}/processing/stretch_correction.py (100%) rename {instamatic => src/instamatic}/server/TEMServer_FEI.py (100%) rename {instamatic => src/instamatic}/server/__init__.py (100%) rename {instamatic => src/instamatic}/server/cam_client.py (100%) rename {instamatic => src/instamatic}/server/cam_server.py (100%) rename {instamatic => src/instamatic}/server/dials_server.py (100%) rename {instamatic => src/instamatic}/server/goniotool_server.py (100%) rename {instamatic => src/instamatic}/server/serializer.py (100%) rename {instamatic => src/instamatic}/server/tem_client.py (100%) rename {instamatic => src/instamatic}/server/tem_server.py (100%) rename {instamatic => src/instamatic}/server/vm_ubuntu_server.py (100%) rename {instamatic => src/instamatic}/server/xds_server.py (100%) rename {instamatic => src/instamatic}/tools.py (100%) rename {instamatic => src/instamatic}/utils/__init__.py (100%) rename {instamatic => src/instamatic}/utils/beamstop.py (100%) rename {instamatic => src/instamatic}/utils/high_precision_timers.py (100%) rename {instamatic => src/instamatic}/utils/progress.py (100%) rename {instamatic => src/instamatic}/utils/singleton.py (100%) rename {instamatic => src/instamatic}/utils/spinbox.py (100%) rename {instamatic => src/instamatic}/utils/xds_parser.py (100%) diff --git a/MANIFEST.in b/MANIFEST.in index ee7d494f..9f4fd525 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -13,17 +13,17 @@ include setup_win.bat include tests/*.py include tests/config/*.yaml include tests/config/*/*.yaml -include instamatic/camera/*.dll -include instamatic/camera/*.h -include instamatic/camera/*.lockfile -include instamatic/camera/*.md -include instamatic/camera/tpx/*.bpc -include instamatic/camera/tpx/*.dacs -include instamatic/camera/tpx/*.txt -include instamatic/config/*.yaml -include instamatic/config/alignments/*.yaml -include instamatic/config/calibration/*.yaml -include instamatic/config/camera/*.yaml -include instamatic/config/microscope/*.yaml -include instamatic/config/scripts/*.md -include instamatic/neural_network/*.p +include src/instamatic/camera/*.dll +include src/instamatic/camera/*.h +include src/instamatic/camera/*.lockfile +include src/instamatic/camera/*.md +include src/instamatic/camera/tpx/*.bpc +include src/instamatic/camera/tpx/*.dacs +include src/instamatic/camera/tpx/*.txt +include src/instamatic/config/*.yaml +include src/instamatic/config/alignments/*.yaml +include src/instamatic/config/calibration/*.yaml +include src/instamatic/config/camera/*.yaml +include src/instamatic/config/microscope/*.yaml +include src/instamatic/config/scripts/*.md +include src/instamatic/neural_network/*.p diff --git a/instamatic/TEMController/TEMController.py b/src/instamatic/TEMController/TEMController.py similarity index 100% rename from instamatic/TEMController/TEMController.py rename to src/instamatic/TEMController/TEMController.py diff --git a/instamatic/TEMController/__init__.py b/src/instamatic/TEMController/__init__.py similarity index 100% rename from instamatic/TEMController/__init__.py rename to src/instamatic/TEMController/__init__.py diff --git a/instamatic/TEMController/deflectors.py b/src/instamatic/TEMController/deflectors.py similarity index 100% rename from instamatic/TEMController/deflectors.py rename to src/instamatic/TEMController/deflectors.py diff --git a/instamatic/TEMController/fei_microscope.py b/src/instamatic/TEMController/fei_microscope.py similarity index 100% rename from instamatic/TEMController/fei_microscope.py rename to src/instamatic/TEMController/fei_microscope.py diff --git a/instamatic/TEMController/fei_simu_microscope.py b/src/instamatic/TEMController/fei_simu_microscope.py similarity index 100% rename from instamatic/TEMController/fei_simu_microscope.py rename to src/instamatic/TEMController/fei_simu_microscope.py diff --git a/instamatic/TEMController/jeol_microscope.py b/src/instamatic/TEMController/jeol_microscope.py similarity index 100% rename from instamatic/TEMController/jeol_microscope.py rename to src/instamatic/TEMController/jeol_microscope.py diff --git a/instamatic/TEMController/lenses.py b/src/instamatic/TEMController/lenses.py similarity index 100% rename from instamatic/TEMController/lenses.py rename to src/instamatic/TEMController/lenses.py diff --git a/instamatic/TEMController/microscope.py b/src/instamatic/TEMController/microscope.py similarity index 100% rename from instamatic/TEMController/microscope.py rename to src/instamatic/TEMController/microscope.py diff --git a/instamatic/TEMController/microscope_client.py b/src/instamatic/TEMController/microscope_client.py similarity index 100% rename from instamatic/TEMController/microscope_client.py rename to src/instamatic/TEMController/microscope_client.py diff --git a/instamatic/TEMController/simu_microscope.py b/src/instamatic/TEMController/simu_microscope.py similarity index 100% rename from instamatic/TEMController/simu_microscope.py rename to src/instamatic/TEMController/simu_microscope.py diff --git a/instamatic/TEMController/stage.py b/src/instamatic/TEMController/stage.py similarity index 100% rename from instamatic/TEMController/stage.py rename to src/instamatic/TEMController/stage.py diff --git a/instamatic/TEMController/states.py b/src/instamatic/TEMController/states.py similarity index 100% rename from instamatic/TEMController/states.py rename to src/instamatic/TEMController/states.py diff --git a/instamatic/__init__.py b/src/instamatic/__init__.py similarity index 100% rename from instamatic/__init__.py rename to src/instamatic/__init__.py diff --git a/instamatic/acquire_at_items.py b/src/instamatic/acquire_at_items.py similarity index 100% rename from instamatic/acquire_at_items.py rename to src/instamatic/acquire_at_items.py diff --git a/instamatic/admin.py b/src/instamatic/admin.py similarity index 100% rename from instamatic/admin.py rename to src/instamatic/admin.py diff --git a/instamatic/banner.py b/src/instamatic/banner.py similarity index 100% rename from instamatic/banner.py rename to src/instamatic/banner.py diff --git a/instamatic/browser.py b/src/instamatic/browser.py similarity index 100% rename from instamatic/browser.py rename to src/instamatic/browser.py diff --git a/instamatic/calibrate/__init__.py b/src/instamatic/calibrate/__init__.py similarity index 100% rename from instamatic/calibrate/__init__.py rename to src/instamatic/calibrate/__init__.py diff --git a/instamatic/calibrate/calibrate_beamshift.py b/src/instamatic/calibrate/calibrate_beamshift.py similarity index 100% rename from instamatic/calibrate/calibrate_beamshift.py rename to src/instamatic/calibrate/calibrate_beamshift.py diff --git a/instamatic/calibrate/calibrate_brightness.py b/src/instamatic/calibrate/calibrate_brightness.py similarity index 100% rename from instamatic/calibrate/calibrate_brightness.py rename to src/instamatic/calibrate/calibrate_brightness.py diff --git a/instamatic/calibrate/calibrate_directbeam.py b/src/instamatic/calibrate/calibrate_directbeam.py similarity index 100% rename from instamatic/calibrate/calibrate_directbeam.py rename to src/instamatic/calibrate/calibrate_directbeam.py diff --git a/instamatic/calibrate/calibrate_imageshift12.py b/src/instamatic/calibrate/calibrate_imageshift12.py similarity index 100% rename from instamatic/calibrate/calibrate_imageshift12.py rename to src/instamatic/calibrate/calibrate_imageshift12.py diff --git a/instamatic/calibrate/calibrate_stage_lowmag.py b/src/instamatic/calibrate/calibrate_stage_lowmag.py similarity index 100% rename from instamatic/calibrate/calibrate_stage_lowmag.py rename to src/instamatic/calibrate/calibrate_stage_lowmag.py diff --git a/instamatic/calibrate/calibrate_stage_mag1.py b/src/instamatic/calibrate/calibrate_stage_mag1.py similarity index 100% rename from instamatic/calibrate/calibrate_stage_mag1.py rename to src/instamatic/calibrate/calibrate_stage_mag1.py diff --git a/instamatic/calibrate/calibrate_stagematrix.py b/src/instamatic/calibrate/calibrate_stagematrix.py similarity index 100% rename from instamatic/calibrate/calibrate_stagematrix.py rename to src/instamatic/calibrate/calibrate_stagematrix.py diff --git a/instamatic/calibrate/center_z.py b/src/instamatic/calibrate/center_z.py similarity index 100% rename from instamatic/calibrate/center_z.py rename to src/instamatic/calibrate/center_z.py diff --git a/instamatic/calibrate/filenames.py b/src/instamatic/calibrate/filenames.py similarity index 100% rename from instamatic/calibrate/filenames.py rename to src/instamatic/calibrate/filenames.py diff --git a/instamatic/calibrate/fit.py b/src/instamatic/calibrate/fit.py similarity index 100% rename from instamatic/calibrate/fit.py rename to src/instamatic/calibrate/fit.py diff --git a/instamatic/camera/CCDCOM.h b/src/instamatic/camera/CCDCOM.h similarity index 100% rename from instamatic/camera/CCDCOM.h rename to src/instamatic/camera/CCDCOM.h diff --git a/instamatic/camera/CCDCOM2_x64_gatan.dll b/src/instamatic/camera/CCDCOM2_x64_gatan.dll similarity index 100% rename from instamatic/camera/CCDCOM2_x64_gatan.dll rename to src/instamatic/camera/CCDCOM2_x64_gatan.dll diff --git a/instamatic/camera/CCDCOM2_x64_simulation.dll b/src/instamatic/camera/CCDCOM2_x64_simulation.dll similarity index 100% rename from instamatic/camera/CCDCOM2_x64_simulation.dll rename to src/instamatic/camera/CCDCOM2_x64_simulation.dll diff --git a/instamatic/camera/CCDCOM2_x86_gatan.dll b/src/instamatic/camera/CCDCOM2_x86_gatan.dll similarity index 100% rename from instamatic/camera/CCDCOM2_x86_gatan.dll rename to src/instamatic/camera/CCDCOM2_x86_gatan.dll diff --git a/instamatic/camera/CCDCOM2_x86_simulation.dll b/src/instamatic/camera/CCDCOM2_x86_simulation.dll similarity index 100% rename from instamatic/camera/CCDCOM2_x86_simulation.dll rename to src/instamatic/camera/CCDCOM2_x86_simulation.dll diff --git a/instamatic/camera/EMCameraObj.dll b/src/instamatic/camera/EMCameraObj.dll similarity index 100% rename from instamatic/camera/EMCameraObj.dll rename to src/instamatic/camera/EMCameraObj.dll diff --git a/instamatic/camera/__init__.py b/src/instamatic/camera/__init__.py similarity index 100% rename from instamatic/camera/__init__.py rename to src/instamatic/camera/__init__.py diff --git a/instamatic/camera/camera.py b/src/instamatic/camera/camera.py similarity index 100% rename from instamatic/camera/camera.py rename to src/instamatic/camera/camera.py diff --git a/instamatic/camera/camera_client.py b/src/instamatic/camera/camera_client.py similarity index 100% rename from instamatic/camera/camera_client.py rename to src/instamatic/camera/camera_client.py diff --git a/instamatic/camera/camera_emmenu.py b/src/instamatic/camera/camera_emmenu.py similarity index 100% rename from instamatic/camera/camera_emmenu.py rename to src/instamatic/camera/camera_emmenu.py diff --git a/instamatic/camera/camera_gatan.py b/src/instamatic/camera/camera_gatan.py similarity index 100% rename from instamatic/camera/camera_gatan.py rename to src/instamatic/camera/camera_gatan.py diff --git a/instamatic/camera/camera_gatan2.py b/src/instamatic/camera/camera_gatan2.py similarity index 100% rename from instamatic/camera/camera_gatan2.py rename to src/instamatic/camera/camera_gatan2.py diff --git a/instamatic/camera/camera_merlin.py b/src/instamatic/camera/camera_merlin.py similarity index 100% rename from instamatic/camera/camera_merlin.py rename to src/instamatic/camera/camera_merlin.py diff --git a/instamatic/camera/camera_serval.py b/src/instamatic/camera/camera_serval.py similarity index 100% rename from instamatic/camera/camera_serval.py rename to src/instamatic/camera/camera_serval.py diff --git a/instamatic/camera/camera_simu.py b/src/instamatic/camera/camera_simu.py similarity index 100% rename from instamatic/camera/camera_simu.py rename to src/instamatic/camera/camera_simu.py diff --git a/instamatic/camera/camera_timepix.py b/src/instamatic/camera/camera_timepix.py similarity index 100% rename from instamatic/camera/camera_timepix.py rename to src/instamatic/camera/camera_timepix.py diff --git a/instamatic/camera/fakevideostream.py b/src/instamatic/camera/fakevideostream.py similarity index 100% rename from instamatic/camera/fakevideostream.py rename to src/instamatic/camera/fakevideostream.py diff --git a/instamatic/camera/gatansocket3.md b/src/instamatic/camera/gatansocket3.md similarity index 100% rename from instamatic/camera/gatansocket3.md rename to src/instamatic/camera/gatansocket3.md diff --git a/instamatic/camera/gatansocket3.py b/src/instamatic/camera/gatansocket3.py similarity index 100% rename from instamatic/camera/gatansocket3.py rename to src/instamatic/camera/gatansocket3.py diff --git a/instamatic/camera/merlin_io.py b/src/instamatic/camera/merlin_io.py similarity index 100% rename from instamatic/camera/merlin_io.py rename to src/instamatic/camera/merlin_io.py diff --git a/instamatic/camera/mpxhwrelaxd.dll b/src/instamatic/camera/mpxhwrelaxd.dll similarity index 100% rename from instamatic/camera/mpxhwrelaxd.dll rename to src/instamatic/camera/mpxhwrelaxd.dll diff --git a/instamatic/camera/timepix.lockfile b/src/instamatic/camera/timepix.lockfile similarity index 100% rename from instamatic/camera/timepix.lockfile rename to src/instamatic/camera/timepix.lockfile diff --git a/instamatic/camera/tpx/171207_with_flatfield.bpc b/src/instamatic/camera/tpx/171207_with_flatfield.bpc similarity index 100% rename from instamatic/camera/tpx/171207_with_flatfield.bpc rename to src/instamatic/camera/tpx/171207_with_flatfield.bpc diff --git a/instamatic/camera/tpx/171207_with_flatfield.bpc.dacs b/src/instamatic/camera/tpx/171207_with_flatfield.bpc.dacs similarity index 100% rename from instamatic/camera/tpx/171207_with_flatfield.bpc.dacs rename to src/instamatic/camera/tpx/171207_with_flatfield.bpc.dacs diff --git a/instamatic/camera/tpx/HW.dacs b/src/instamatic/camera/tpx/HW.dacs similarity index 100% rename from instamatic/camera/tpx/HW.dacs rename to src/instamatic/camera/tpx/HW.dacs diff --git a/instamatic/camera/tpx/config.txt b/src/instamatic/camera/tpx/config.txt similarity index 100% rename from instamatic/camera/tpx/config.txt rename to src/instamatic/camera/tpx/config.txt diff --git a/instamatic/camera/videostream.py b/src/instamatic/camera/videostream.py similarity index 100% rename from instamatic/camera/videostream.py rename to src/instamatic/camera/videostream.py diff --git a/instamatic/config/__init__.py b/src/instamatic/config/__init__.py similarity index 100% rename from instamatic/config/__init__.py rename to src/instamatic/config/__init__.py diff --git a/instamatic/config/alignments/neutral.yaml b/src/instamatic/config/alignments/neutral.yaml similarity index 100% rename from instamatic/config/alignments/neutral.yaml rename to src/instamatic/config/alignments/neutral.yaml diff --git a/instamatic/config/autoconfig.py b/src/instamatic/config/autoconfig.py similarity index 100% rename from instamatic/config/autoconfig.py rename to src/instamatic/config/autoconfig.py diff --git a/instamatic/config/calibration/orius.yaml b/src/instamatic/config/calibration/orius.yaml similarity index 100% rename from instamatic/config/calibration/orius.yaml rename to src/instamatic/config/calibration/orius.yaml diff --git a/instamatic/config/calibration/simulate.yaml b/src/instamatic/config/calibration/simulate.yaml similarity index 100% rename from instamatic/config/calibration/simulate.yaml rename to src/instamatic/config/calibration/simulate.yaml diff --git a/instamatic/config/calibration/timepix.yaml b/src/instamatic/config/calibration/timepix.yaml similarity index 100% rename from instamatic/config/calibration/timepix.yaml rename to src/instamatic/config/calibration/timepix.yaml diff --git a/instamatic/config/calibration/tvips-f416.yaml b/src/instamatic/config/calibration/tvips-f416.yaml similarity index 100% rename from instamatic/config/calibration/tvips-f416.yaml rename to src/instamatic/config/calibration/tvips-f416.yaml diff --git a/instamatic/config/camera/merlin.yaml b/src/instamatic/config/camera/merlin.yaml similarity index 100% rename from instamatic/config/camera/merlin.yaml rename to src/instamatic/config/camera/merlin.yaml diff --git a/instamatic/config/camera/orius.yaml b/src/instamatic/config/camera/orius.yaml similarity index 100% rename from instamatic/config/camera/orius.yaml rename to src/instamatic/config/camera/orius.yaml diff --git a/instamatic/config/camera/serval.yaml b/src/instamatic/config/camera/serval.yaml similarity index 100% rename from instamatic/config/camera/serval.yaml rename to src/instamatic/config/camera/serval.yaml diff --git a/instamatic/config/camera/simulate.yaml b/src/instamatic/config/camera/simulate.yaml similarity index 100% rename from instamatic/config/camera/simulate.yaml rename to src/instamatic/config/camera/simulate.yaml diff --git a/instamatic/config/camera/simulateDLL.yaml b/src/instamatic/config/camera/simulateDLL.yaml similarity index 100% rename from instamatic/config/camera/simulateDLL.yaml rename to src/instamatic/config/camera/simulateDLL.yaml diff --git a/instamatic/config/camera/timepix.yaml b/src/instamatic/config/camera/timepix.yaml similarity index 100% rename from instamatic/config/camera/timepix.yaml rename to src/instamatic/config/camera/timepix.yaml diff --git a/instamatic/config/camera/tvips-f416.yaml b/src/instamatic/config/camera/tvips-f416.yaml similarity index 100% rename from instamatic/config/camera/tvips-f416.yaml rename to src/instamatic/config/camera/tvips-f416.yaml diff --git a/instamatic/config/camera/tvips-xf416.yaml b/src/instamatic/config/camera/tvips-xf416.yaml similarity index 100% rename from instamatic/config/camera/tvips-xf416.yaml rename to src/instamatic/config/camera/tvips-xf416.yaml diff --git a/instamatic/config/config_updater.py b/src/instamatic/config/config_updater.py similarity index 100% rename from instamatic/config/config_updater.py rename to src/instamatic/config/config_updater.py diff --git a/instamatic/config/defaults.yaml b/src/instamatic/config/defaults.yaml similarity index 100% rename from instamatic/config/defaults.yaml rename to src/instamatic/config/defaults.yaml diff --git a/instamatic/config/microscope/fei_simu.yaml b/src/instamatic/config/microscope/fei_simu.yaml similarity index 100% rename from instamatic/config/microscope/fei_simu.yaml rename to src/instamatic/config/microscope/fei_simu.yaml diff --git a/instamatic/config/microscope/fei_themisZ.yaml b/src/instamatic/config/microscope/fei_themisZ.yaml similarity index 100% rename from instamatic/config/microscope/fei_themisZ.yaml rename to src/instamatic/config/microscope/fei_themisZ.yaml diff --git a/instamatic/config/microscope/jeol-1400.yaml b/src/instamatic/config/microscope/jeol-1400.yaml similarity index 100% rename from instamatic/config/microscope/jeol-1400.yaml rename to src/instamatic/config/microscope/jeol-1400.yaml diff --git a/instamatic/config/microscope/jeol.yaml b/src/instamatic/config/microscope/jeol.yaml similarity index 100% rename from instamatic/config/microscope/jeol.yaml rename to src/instamatic/config/microscope/jeol.yaml diff --git a/instamatic/config/microscope/simulate.yaml b/src/instamatic/config/microscope/simulate.yaml similarity index 100% rename from instamatic/config/microscope/simulate.yaml rename to src/instamatic/config/microscope/simulate.yaml diff --git a/instamatic/config/scripts/close_down.py b/src/instamatic/config/scripts/close_down.py similarity index 100% rename from instamatic/config/scripts/close_down.py rename to src/instamatic/config/scripts/close_down.py diff --git a/instamatic/config/scripts/focus_mode.py b/src/instamatic/config/scripts/focus_mode.py similarity index 100% rename from instamatic/config/scripts/focus_mode.py rename to src/instamatic/config/scripts/focus_mode.py diff --git a/instamatic/config/scripts/hello_world.py b/src/instamatic/config/scripts/hello_world.py similarity index 100% rename from instamatic/config/scripts/hello_world.py rename to src/instamatic/config/scripts/hello_world.py diff --git a/instamatic/config/scripts/readme.md b/src/instamatic/config/scripts/readme.md similarity index 100% rename from instamatic/config/scripts/readme.md rename to src/instamatic/config/scripts/readme.md diff --git a/instamatic/config/scripts/search_mode.py b/src/instamatic/config/scripts/search_mode.py similarity index 100% rename from instamatic/config/scripts/search_mode.py rename to src/instamatic/config/scripts/search_mode.py diff --git a/instamatic/config/settings.yaml b/src/instamatic/config/settings.yaml similarity index 100% rename from instamatic/config/settings.yaml rename to src/instamatic/config/settings.yaml diff --git a/instamatic/config/utils.py b/src/instamatic/config/utils.py similarity index 100% rename from instamatic/config/utils.py rename to src/instamatic/config/utils.py diff --git a/instamatic/exceptions.py b/src/instamatic/exceptions.py similarity index 100% rename from instamatic/exceptions.py rename to src/instamatic/exceptions.py diff --git a/instamatic/experiments/__init__.py b/src/instamatic/experiments/__init__.py similarity index 100% rename from instamatic/experiments/__init__.py rename to src/instamatic/experiments/__init__.py diff --git a/instamatic/experiments/autocred/__init__.py b/src/instamatic/experiments/autocred/__init__.py similarity index 100% rename from instamatic/experiments/autocred/__init__.py rename to src/instamatic/experiments/autocred/__init__.py diff --git a/instamatic/experiments/autocred/experiment.py b/src/instamatic/experiments/autocred/experiment.py similarity index 100% rename from instamatic/experiments/autocred/experiment.py rename to src/instamatic/experiments/autocred/experiment.py diff --git a/instamatic/experiments/cred/__init__.py b/src/instamatic/experiments/cred/__init__.py similarity index 100% rename from instamatic/experiments/cred/__init__.py rename to src/instamatic/experiments/cred/__init__.py diff --git a/instamatic/experiments/cred/experiment.py b/src/instamatic/experiments/cred/experiment.py similarity index 100% rename from instamatic/experiments/cred/experiment.py rename to src/instamatic/experiments/cred/experiment.py diff --git a/instamatic/experiments/cred_gatan/__init__.py b/src/instamatic/experiments/cred_gatan/__init__.py similarity index 100% rename from instamatic/experiments/cred_gatan/__init__.py rename to src/instamatic/experiments/cred_gatan/__init__.py diff --git a/instamatic/experiments/cred_gatan/experiment.py b/src/instamatic/experiments/cred_gatan/experiment.py similarity index 100% rename from instamatic/experiments/cred_gatan/experiment.py rename to src/instamatic/experiments/cred_gatan/experiment.py diff --git a/instamatic/experiments/cred_tvips/__init__.py b/src/instamatic/experiments/cred_tvips/__init__.py similarity index 100% rename from instamatic/experiments/cred_tvips/__init__.py rename to src/instamatic/experiments/cred_tvips/__init__.py diff --git a/instamatic/experiments/cred_tvips/experiment.py b/src/instamatic/experiments/cred_tvips/experiment.py similarity index 100% rename from instamatic/experiments/cred_tvips/experiment.py rename to src/instamatic/experiments/cred_tvips/experiment.py diff --git a/instamatic/experiments/red/__init__.py b/src/instamatic/experiments/red/__init__.py similarity index 100% rename from instamatic/experiments/red/__init__.py rename to src/instamatic/experiments/red/__init__.py diff --git a/instamatic/experiments/red/experiment.py b/src/instamatic/experiments/red/experiment.py similarity index 100% rename from instamatic/experiments/red/experiment.py rename to src/instamatic/experiments/red/experiment.py diff --git a/instamatic/experiments/serialed/__init__.py b/src/instamatic/experiments/serialed/__init__.py similarity index 100% rename from instamatic/experiments/serialed/__init__.py rename to src/instamatic/experiments/serialed/__init__.py diff --git a/instamatic/experiments/serialed/experiment.py b/src/instamatic/experiments/serialed/experiment.py similarity index 100% rename from instamatic/experiments/serialed/experiment.py rename to src/instamatic/experiments/serialed/experiment.py diff --git a/instamatic/formats/__init__.py b/src/instamatic/formats/__init__.py similarity index 100% rename from instamatic/formats/__init__.py rename to src/instamatic/formats/__init__.py diff --git a/instamatic/formats/adscimage.py b/src/instamatic/formats/adscimage.py similarity index 100% rename from instamatic/formats/adscimage.py rename to src/instamatic/formats/adscimage.py diff --git a/instamatic/formats/csvIO.py b/src/instamatic/formats/csvIO.py similarity index 100% rename from instamatic/formats/csvIO.py rename to src/instamatic/formats/csvIO.py diff --git a/instamatic/formats/mrc.py b/src/instamatic/formats/mrc.py similarity index 100% rename from instamatic/formats/mrc.py rename to src/instamatic/formats/mrc.py diff --git a/instamatic/formats/util.py b/src/instamatic/formats/util.py similarity index 100% rename from instamatic/formats/util.py rename to src/instamatic/formats/util.py diff --git a/instamatic/formats/xdscbf.py b/src/instamatic/formats/xdscbf.py similarity index 100% rename from instamatic/formats/xdscbf.py rename to src/instamatic/formats/xdscbf.py diff --git a/instamatic/goniotool.py b/src/instamatic/goniotool.py similarity index 100% rename from instamatic/goniotool.py rename to src/instamatic/goniotool.py diff --git a/instamatic/gridmontage.py b/src/instamatic/gridmontage.py similarity index 100% rename from instamatic/gridmontage.py rename to src/instamatic/gridmontage.py diff --git a/instamatic/gui/__init__.py b/src/instamatic/gui/__init__.py similarity index 100% rename from instamatic/gui/__init__.py rename to src/instamatic/gui/__init__.py diff --git a/instamatic/gui/about_frame.py b/src/instamatic/gui/about_frame.py similarity index 100% rename from instamatic/gui/about_frame.py rename to src/instamatic/gui/about_frame.py diff --git a/instamatic/gui/autocred_frame.py b/src/instamatic/gui/autocred_frame.py similarity index 100% rename from instamatic/gui/autocred_frame.py rename to src/instamatic/gui/autocred_frame.py diff --git a/instamatic/gui/base_module.py b/src/instamatic/gui/base_module.py similarity index 100% rename from instamatic/gui/base_module.py rename to src/instamatic/gui/base_module.py diff --git a/instamatic/gui/console_frame.py b/src/instamatic/gui/console_frame.py similarity index 100% rename from instamatic/gui/console_frame.py rename to src/instamatic/gui/console_frame.py diff --git a/instamatic/gui/cred_fei_frame.py b/src/instamatic/gui/cred_fei_frame.py similarity index 100% rename from instamatic/gui/cred_fei_frame.py rename to src/instamatic/gui/cred_fei_frame.py diff --git a/instamatic/gui/cred_frame.py b/src/instamatic/gui/cred_frame.py similarity index 100% rename from instamatic/gui/cred_frame.py rename to src/instamatic/gui/cred_frame.py diff --git a/instamatic/gui/cred_tvips_frame.py b/src/instamatic/gui/cred_tvips_frame.py similarity index 100% rename from instamatic/gui/cred_tvips_frame.py rename to src/instamatic/gui/cred_tvips_frame.py diff --git a/instamatic/gui/ctrl_frame.py b/src/instamatic/gui/ctrl_frame.py similarity index 100% rename from instamatic/gui/ctrl_frame.py rename to src/instamatic/gui/ctrl_frame.py diff --git a/instamatic/gui/debug_frame.py b/src/instamatic/gui/debug_frame.py similarity index 100% rename from instamatic/gui/debug_frame.py rename to src/instamatic/gui/debug_frame.py diff --git a/instamatic/gui/defocus_button.py b/src/instamatic/gui/defocus_button.py similarity index 100% rename from instamatic/gui/defocus_button.py rename to src/instamatic/gui/defocus_button.py diff --git a/instamatic/gui/gui.py b/src/instamatic/gui/gui.py similarity index 100% rename from instamatic/gui/gui.py rename to src/instamatic/gui/gui.py diff --git a/instamatic/gui/io_frame.py b/src/instamatic/gui/io_frame.py similarity index 100% rename from instamatic/gui/io_frame.py rename to src/instamatic/gui/io_frame.py diff --git a/instamatic/gui/jobs.py b/src/instamatic/gui/jobs.py similarity index 100% rename from instamatic/gui/jobs.py rename to src/instamatic/gui/jobs.py diff --git a/instamatic/gui/machine_learning_frame.py b/src/instamatic/gui/machine_learning_frame.py similarity index 100% rename from instamatic/gui/machine_learning_frame.py rename to src/instamatic/gui/machine_learning_frame.py diff --git a/instamatic/gui/modules.py b/src/instamatic/gui/modules.py similarity index 100% rename from instamatic/gui/modules.py rename to src/instamatic/gui/modules.py diff --git a/instamatic/gui/mpl_frame.py b/src/instamatic/gui/mpl_frame.py similarity index 100% rename from instamatic/gui/mpl_frame.py rename to src/instamatic/gui/mpl_frame.py diff --git a/instamatic/gui/red_frame.py b/src/instamatic/gui/red_frame.py similarity index 100% rename from instamatic/gui/red_frame.py rename to src/instamatic/gui/red_frame.py diff --git a/instamatic/gui/sed_frame.py b/src/instamatic/gui/sed_frame.py similarity index 100% rename from instamatic/gui/sed_frame.py rename to src/instamatic/gui/sed_frame.py diff --git a/instamatic/gui/videostream_frame.py b/src/instamatic/gui/videostream_frame.py similarity index 100% rename from instamatic/gui/videostream_frame.py rename to src/instamatic/gui/videostream_frame.py diff --git a/instamatic/image_utils.py b/src/instamatic/image_utils.py similarity index 100% rename from instamatic/image_utils.py rename to src/instamatic/image_utils.py diff --git a/instamatic/imreg.py b/src/instamatic/imreg.py similarity index 100% rename from instamatic/imreg.py rename to src/instamatic/imreg.py diff --git a/instamatic/io.py b/src/instamatic/io.py similarity index 100% rename from instamatic/io.py rename to src/instamatic/io.py diff --git a/instamatic/main.py b/src/instamatic/main.py similarity index 100% rename from instamatic/main.py rename to src/instamatic/main.py diff --git a/instamatic/montage.py b/src/instamatic/montage.py similarity index 100% rename from instamatic/montage.py rename to src/instamatic/montage.py diff --git a/instamatic/neural_network/__init__.py b/src/instamatic/neural_network/__init__.py similarity index 100% rename from instamatic/neural_network/__init__.py rename to src/instamatic/neural_network/__init__.py diff --git a/instamatic/neural_network/neural_network.py b/src/instamatic/neural_network/neural_network.py similarity index 100% rename from instamatic/neural_network/neural_network.py rename to src/instamatic/neural_network/neural_network.py diff --git a/instamatic/neural_network/preprocess.py b/src/instamatic/neural_network/preprocess.py similarity index 100% rename from instamatic/neural_network/preprocess.py rename to src/instamatic/neural_network/preprocess.py diff --git a/instamatic/neural_network/preprocess_SerialRED.py b/src/instamatic/neural_network/preprocess_SerialRED.py similarity index 100% rename from instamatic/neural_network/preprocess_SerialRED.py rename to src/instamatic/neural_network/preprocess_SerialRED.py diff --git a/instamatic/neural_network/weights-py2.p b/src/instamatic/neural_network/weights-py2.p similarity index 100% rename from instamatic/neural_network/weights-py2.p rename to src/instamatic/neural_network/weights-py2.p diff --git a/instamatic/neural_network/weights-py3.p b/src/instamatic/neural_network/weights-py3.p similarity index 100% rename from instamatic/neural_network/weights-py3.p rename to src/instamatic/neural_network/weights-py3.p diff --git a/instamatic/processing/ImgConversion.py b/src/instamatic/processing/ImgConversion.py similarity index 100% rename from instamatic/processing/ImgConversion.py rename to src/instamatic/processing/ImgConversion.py diff --git a/instamatic/processing/ImgConversionDM.py b/src/instamatic/processing/ImgConversionDM.py similarity index 100% rename from instamatic/processing/ImgConversionDM.py rename to src/instamatic/processing/ImgConversionDM.py diff --git a/instamatic/processing/ImgConversionTPX.py b/src/instamatic/processing/ImgConversionTPX.py similarity index 100% rename from instamatic/processing/ImgConversionTPX.py rename to src/instamatic/processing/ImgConversionTPX.py diff --git a/instamatic/processing/ImgConversionTVIPS.py b/src/instamatic/processing/ImgConversionTVIPS.py similarity index 100% rename from instamatic/processing/ImgConversionTVIPS.py rename to src/instamatic/processing/ImgConversionTVIPS.py diff --git a/instamatic/processing/XDS_template.py b/src/instamatic/processing/XDS_template.py similarity index 100% rename from instamatic/processing/XDS_template.py rename to src/instamatic/processing/XDS_template.py diff --git a/instamatic/processing/XDS_templateDM.py b/src/instamatic/processing/XDS_templateDM.py similarity index 100% rename from instamatic/processing/XDS_templateDM.py rename to src/instamatic/processing/XDS_templateDM.py diff --git a/instamatic/processing/XDS_templateTPX.py b/src/instamatic/processing/XDS_templateTPX.py similarity index 100% rename from instamatic/processing/XDS_templateTPX.py rename to src/instamatic/processing/XDS_templateTPX.py diff --git a/instamatic/processing/XDS_templateTVIPS.py b/src/instamatic/processing/XDS_templateTVIPS.py similarity index 100% rename from instamatic/processing/XDS_templateTVIPS.py rename to src/instamatic/processing/XDS_templateTVIPS.py diff --git a/instamatic/processing/__init__.py b/src/instamatic/processing/__init__.py similarity index 100% rename from instamatic/processing/__init__.py rename to src/instamatic/processing/__init__.py diff --git a/instamatic/processing/find_crystals.py b/src/instamatic/processing/find_crystals.py similarity index 100% rename from instamatic/processing/find_crystals.py rename to src/instamatic/processing/find_crystals.py diff --git a/instamatic/processing/find_crystals_ilastik.py b/src/instamatic/processing/find_crystals_ilastik.py similarity index 100% rename from instamatic/processing/find_crystals_ilastik.py rename to src/instamatic/processing/find_crystals_ilastik.py diff --git a/instamatic/processing/find_holes.py b/src/instamatic/processing/find_holes.py similarity index 100% rename from instamatic/processing/find_holes.py rename to src/instamatic/processing/find_holes.py diff --git a/instamatic/processing/flatfield.py b/src/instamatic/processing/flatfield.py similarity index 100% rename from instamatic/processing/flatfield.py rename to src/instamatic/processing/flatfield.py diff --git a/instamatic/processing/stretch_correction.py b/src/instamatic/processing/stretch_correction.py similarity index 100% rename from instamatic/processing/stretch_correction.py rename to src/instamatic/processing/stretch_correction.py diff --git a/instamatic/server/TEMServer_FEI.py b/src/instamatic/server/TEMServer_FEI.py similarity index 100% rename from instamatic/server/TEMServer_FEI.py rename to src/instamatic/server/TEMServer_FEI.py diff --git a/instamatic/server/__init__.py b/src/instamatic/server/__init__.py similarity index 100% rename from instamatic/server/__init__.py rename to src/instamatic/server/__init__.py diff --git a/instamatic/server/cam_client.py b/src/instamatic/server/cam_client.py similarity index 100% rename from instamatic/server/cam_client.py rename to src/instamatic/server/cam_client.py diff --git a/instamatic/server/cam_server.py b/src/instamatic/server/cam_server.py similarity index 100% rename from instamatic/server/cam_server.py rename to src/instamatic/server/cam_server.py diff --git a/instamatic/server/dials_server.py b/src/instamatic/server/dials_server.py similarity index 100% rename from instamatic/server/dials_server.py rename to src/instamatic/server/dials_server.py diff --git a/instamatic/server/goniotool_server.py b/src/instamatic/server/goniotool_server.py similarity index 100% rename from instamatic/server/goniotool_server.py rename to src/instamatic/server/goniotool_server.py diff --git a/instamatic/server/serializer.py b/src/instamatic/server/serializer.py similarity index 100% rename from instamatic/server/serializer.py rename to src/instamatic/server/serializer.py diff --git a/instamatic/server/tem_client.py b/src/instamatic/server/tem_client.py similarity index 100% rename from instamatic/server/tem_client.py rename to src/instamatic/server/tem_client.py diff --git a/instamatic/server/tem_server.py b/src/instamatic/server/tem_server.py similarity index 100% rename from instamatic/server/tem_server.py rename to src/instamatic/server/tem_server.py diff --git a/instamatic/server/vm_ubuntu_server.py b/src/instamatic/server/vm_ubuntu_server.py similarity index 100% rename from instamatic/server/vm_ubuntu_server.py rename to src/instamatic/server/vm_ubuntu_server.py diff --git a/instamatic/server/xds_server.py b/src/instamatic/server/xds_server.py similarity index 100% rename from instamatic/server/xds_server.py rename to src/instamatic/server/xds_server.py diff --git a/instamatic/tools.py b/src/instamatic/tools.py similarity index 100% rename from instamatic/tools.py rename to src/instamatic/tools.py diff --git a/instamatic/utils/__init__.py b/src/instamatic/utils/__init__.py similarity index 100% rename from instamatic/utils/__init__.py rename to src/instamatic/utils/__init__.py diff --git a/instamatic/utils/beamstop.py b/src/instamatic/utils/beamstop.py similarity index 100% rename from instamatic/utils/beamstop.py rename to src/instamatic/utils/beamstop.py diff --git a/instamatic/utils/high_precision_timers.py b/src/instamatic/utils/high_precision_timers.py similarity index 100% rename from instamatic/utils/high_precision_timers.py rename to src/instamatic/utils/high_precision_timers.py diff --git a/instamatic/utils/progress.py b/src/instamatic/utils/progress.py similarity index 100% rename from instamatic/utils/progress.py rename to src/instamatic/utils/progress.py diff --git a/instamatic/utils/singleton.py b/src/instamatic/utils/singleton.py similarity index 100% rename from instamatic/utils/singleton.py rename to src/instamatic/utils/singleton.py diff --git a/instamatic/utils/spinbox.py b/src/instamatic/utils/spinbox.py similarity index 100% rename from instamatic/utils/spinbox.py rename to src/instamatic/utils/spinbox.py diff --git a/instamatic/utils/xds_parser.py b/src/instamatic/utils/xds_parser.py similarity index 100% rename from instamatic/utils/xds_parser.py rename to src/instamatic/utils/xds_parser.py From eb4430a3c869fdbac65db9bb55e7e4fa4c29938a Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 09:37:35 +0200 Subject: [PATCH 05/19] Fix paths and urls --- .github/workflows/test.yml | 2 +- docs/config.md | 2 +- docs/merlin.md | 2 +- docs/programs.md | 2 +- docs/tem_api.md | 2 +- docs/tvips.md | 2 +- mkdocs.yml | 2 +- readme.md | 10 +++++----- scripts/process_dm.py | 2 +- src/instamatic/server/TEMServer_FEI.py | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1c96a793..6ba97346 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,7 +37,7 @@ jobs: id: cache-python-env with: path: ${{ env.pythonLocation }} - key: ${{ env.pythonLocation }}-${{ hashFiles('setup.cfg') }} + key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }} - name: Install if: steps.cache-python-env.outputs.cache-hit != 'true' diff --git a/docs/config.md b/docs/config.md index 6a64013b..262afddb 100644 --- a/docs/config.md +++ b/docs/config.md @@ -26,7 +26,7 @@ instamatic.autoconfig.exe ``` To help generate some of the input files (in particular templates for the microscope/calibration files). -Examples of configuration files can be found [here](https://github.com/instamatic-dev/instamatic/tree/main/instamatic/config). +Examples of configuration files can be found [here](https://github.com/instamatic-dev/instamatic/tree/main/src/instamatic/config). ## settings.yaml diff --git a/docs/merlin.md b/docs/merlin.md index 4babef53..325a621c 100644 --- a/docs/merlin.md +++ b/docs/merlin.md @@ -16,7 +16,7 @@ camera: merlin You can set up the parameters for the Merlin camera through `camera/merlin.yaml` in your config directory. -For an example config file, see: [`camera/merlin.yaml`](https://github.com/instamatic-dev/instamatic/blob/main/instamatic/config/camera/merlin.yaml). [Click here](/config.md#camerayaml) to go to the page with all common camera configuration parameters. +For an example config file, see: [`camera/merlin.yaml`](https://github.com/instamatic-dev/instamatic/blob/main/src/instamatic/config/camera/merlin.yaml). [Click here](/config.md#camerayaml) to go to the page with all common camera configuration parameters. In addition, the Merlin camera has the following parameters to configure: diff --git a/docs/programs.md b/docs/programs.md index 9ffcff83..5708d641 100644 --- a/docs/programs.md +++ b/docs/programs.md @@ -604,7 +604,7 @@ instamatic.xdsserver [-h] ## instamatic.temserver_fei -Utility script to enable rotation control from a dmscript. See [https://github.com/instamatic-dev/instamatic/tree/master/dmscript] for usage. +Utility script to enable rotation control from a dmscript. See [https://github.com/instamatic-dev/InsteaDMatic] for usage. **Usage:** ```bash diff --git a/docs/tem_api.md b/docs/tem_api.md index 9085bf77..ea7b577e 100644 --- a/docs/tem_api.md +++ b/docs/tem_api.md @@ -31,7 +31,7 @@ ctrl = TEMController.initialize(tem_name='jeol', cam_name=None) Once a `ctrl` (control) object has been initialized, it becomes possible to play around with the lenses and stage interactively. Type `ctrl.` and hit `tab` to see the autocomplete options. Or write use `?` to request the doc string for a function (e.g. `TEMController.initialize?`). -Based on this you can write your own python scripts to control the microscope and/or camera. See in `instamatic/instamatic/experiments/cred/experiment.py` for an idea how this is used. All the microscope control interface can be found in `instamatic/TEMController/` +Based on this you can write your own python scripts to control the microscope and/or camera. See in `src/instamatic/experiments/cred/experiment.py` for an idea how this is used. All the microscope control interface can be found in `src/instamatic/TEMController/` The `ctrl` object allows full control over the electron microscope. For example, to read out the position of the sample stage: ```python diff --git a/docs/tvips.md b/docs/tvips.md index 023da7c9..d02a6962 100644 --- a/docs/tvips.md +++ b/docs/tvips.md @@ -71,7 +71,7 @@ Stop live view : Stop the live view in EMMENU. Search -: Switch the microscope to search mode. Internally, these are defined as [`instamatic` scripts](https://github.com/instamatic-dev/instamatic/tree/main/instamatic/config/scripts) and can therefore be easily modified. The parameters of the search mode are defined in `$instamatic\scripts\search_mode.py`, for example to put the screen down, unblank the beam, and switch to MAG1 mode: +: Switch the microscope to search mode. Internally, these are defined as [`instamatic` scripts](https://github.com/instamatic-dev/instamatic/tree/main/src/instamatic/config/scripts) and can therefore be easily modified. The parameters of the search mode are defined in `$instamatic\scripts\search_mode.py`, for example to put the screen down, unblank the beam, and switch to MAG1 mode: ```python ctrl.screen.down() diff --git a/mkdocs.yml b/mkdocs.yml index 1b4ee9b1..ac963432 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -86,5 +86,5 @@ plugins: include_source: True watch: - - instamatic/ + - src/instamatic/ - docs/ diff --git a/readme.md b/readme.md index 4e431e66..014a7ecd 100644 --- a/readme.md +++ b/readme.md @@ -26,7 +26,7 @@ Cameras supported: Instamatic has been developed on a JEOL-2100 with a Timepix camera, and a JEOL-1400 and JEOL-3200 with TVIPS cameras (XF416/F416). -[1]: Support for Gatan cameras is somewhat underdeveloped. As an alternative, a DigitalMicrograph script for collecting cRED data on a OneView camera (or any other Gatan camera) can be found at [dmscript](https://github.com/instamatic-dev/InsteaDMatic). +[1]: Support for Gatan cameras is somewhat underdeveloped. As an alternative, a DigitalMicrograph script for collecting cRED data on a OneView camera (or any other Gatan camera) can be found [here](https://github.com/instamatic-dev/InsteaDMatic). ## Installation @@ -50,7 +50,7 @@ The package requires Windows 7 or higher. It has been mainly developed and teste ## Package dependencies -Check [setup.cfg](setup.cfg) for the full dependency list and versions. +Check [pypoject.toml](pypoject.toml) for the full dependency list and versions. ## Documentation @@ -76,7 +76,8 @@ Alternatively, some of the methods implemented in `Instamatic` are described in: * **`demos/`** - Jupyter demo notebooks * **`docs/`** - Documentation -* **`instamatic/`** +* **`src/`** - Source code for instamatic +* **`src/instamatic/`** * **`TEMController/`** - Microscope interaction code * **`calibrate/`** - Tools for calibration * **`camera/`** - Camera interaction code @@ -103,5 +104,4 @@ Alternatively, some of the methods implemented in `Instamatic` are described in: * **`navigation.py`** - Optimize navigation paths * **`tools.py`** - Collection of functions used throughout the code * **`scripts/`** - Helpful scripts -* **`setup.cfg`** - Dependency/build system declaration -* **`setup.py`** - Old-style build script +* **`pyproject.toml`** - Dependency/build system declaration diff --git a/scripts/process_dm.py b/scripts/process_dm.py index 918beb5c..1de82c9b 100644 --- a/scripts/process_dm.py +++ b/scripts/process_dm.py @@ -7,7 +7,7 @@ from instamatic.processing.ImgConversionDM import ImgConversionDM as ImgConversion # Script to process cRED data collecting using the DigitalMicrograph script `insteaDMatic` -# https://github.com/instamatic-dev/instamatic/tree/master/dmscript +# https://github.com/instamatic-dev/InsteaDMatic # # To use: # Run `python process_dm.py cred_log.txt` diff --git a/src/instamatic/server/TEMServer_FEI.py b/src/instamatic/server/TEMServer_FEI.py index 96bfbb5b..e3499239 100644 --- a/src/instamatic/server/TEMServer_FEI.py +++ b/src/instamatic/server/TEMServer_FEI.py @@ -1,5 +1,5 @@ """Utility script to enable rotation control from a dmscript See -`https://github.com/instamatic-dev/instamatic/tree/master/dmscript` for +`https://github.com/instamatic-dev/InsteaDMatic` for usage.""" import datetime import logging @@ -46,7 +46,7 @@ def main(): import argparse description = """ -Utility script to enable rotation control from a dmscript. See [https://github.com/instamatic-dev/instamatic/tree/master/dmscript] for usage. +Utility script to enable rotation control from a dmscript. See [https://github.com/instamatic-dev/InsteaDMatic] for usage. """ parser = argparse.ArgumentParser( From 2e98dbaeb606ed661ce96ea6237d4810f38e0a6b Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 09:45:23 +0200 Subject: [PATCH 06/19] Snakecase releaseConnection and getImage --- docs/merlin.md | 2 +- src/instamatic/TEMController/TEMController.py | 2 +- .../TEMController/fei_microscope.py | 4 +- .../TEMController/fei_simu_microscope.py | 4 +- .../TEMController/jeol_microscope.py | 4 +- .../TEMController/simu_microscope.py | 2 +- src/instamatic/camera/camera.py | 2 +- src/instamatic/camera/camera_client.py | 2 +- src/instamatic/camera/camera_emmenu.py | 6 +-- src/instamatic/camera/camera_gatan.py | 6 +-- src/instamatic/camera/camera_gatan2.py | 38 +++++++++---------- src/instamatic/camera/camera_merlin.py | 12 +++--- src/instamatic/camera/camera_serval.py | 6 +-- src/instamatic/camera/camera_simu.py | 8 ++-- src/instamatic/camera/camera_timepix.py | 2 +- src/instamatic/camera/fakevideostream.py | 6 +-- src/instamatic/camera/videostream.py | 8 ++-- src/instamatic/server/cam_server.py | 2 +- 18 files changed, 58 insertions(+), 58 deletions(-) diff --git a/docs/merlin.md b/docs/merlin.md index 325a621c..362ad49f 100644 --- a/docs/merlin.md +++ b/docs/merlin.md @@ -4,7 +4,7 @@ The [MerlinEM detector](https://quantumdetectors.com/products/merlinem/) by Quan Instamatic communicates with the Merlin control software via TCP/IP connection. This means that there is a fast connection with little overhead when collecting data. -In continous read/write mode, instamatic can achieve gapless data acquisition `MerlinCamera.getMovie()`. When continuously collecting single images using `MerlinCamera.getImage()`, there is a ~3 ms overhead per frame. +In continous read/write mode, instamatic can achieve gapless data acquisition `MerlinCamera.getMovie()`. When continuously collecting single images using `MerlinCamera.get_image()`, there is a ~3 ms overhead per frame. ## Setup diff --git a/src/instamatic/TEMController/TEMController.py b/src/instamatic/TEMController/TEMController.py index 60fe2eca..4db17a99 100644 --- a/src/instamatic/TEMController/TEMController.py +++ b/src/instamatic/TEMController/TEMController.py @@ -520,7 +520,7 @@ def get_raw_image(self, exposure: float = None, binsize: int = None) -> np.ndarr arr : np.array Image as 2D numpy array. """ - return self.cam.getImage(exposure=exposure, binsize=binsize) + return self.cam.get_image(exposure=exposure, binsize=binsize) def get_future_image(self, exposure: float = None, binsize: int = None) -> 'future': """Simplified function equivalent to `get_image` that returns the raw diff --git a/src/instamatic/TEMController/fei_microscope.py b/src/instamatic/TEMController/fei_microscope.py index f92eb4d1..7afa5e42 100644 --- a/src/instamatic/TEMController/fei_microscope.py +++ b/src/instamatic/TEMController/fei_microscope.py @@ -82,7 +82,7 @@ def __init__(self, name='fei'): raise TEMCommunicationError('Cannot establish microscope connection (timeout).') logger.info('Microscope connection established') - atexit.register(self.releaseConnection) + atexit.register(self.release_connection) self.name = name self.FUNCTION_MODES = FUNCTION_MODES @@ -400,7 +400,7 @@ def setDiffShift(self, x, y): self.tem.Projection.DiffractionShift = ds1 - def releaseConnection(self): + def release_connection(self): comtypes.CoUninitialize() logger.info('Connection to microscope released') print('Connection to microscope released') diff --git a/src/instamatic/TEMController/fei_simu_microscope.py b/src/instamatic/TEMController/fei_simu_microscope.py index af0f46d2..a4a9de02 100644 --- a/src/instamatic/TEMController/fei_simu_microscope.py +++ b/src/instamatic/TEMController/fei_simu_microscope.py @@ -52,7 +52,7 @@ def __init__(self, name='fei_simu'): raise TEMCommunicationError('Cannot establish microscope connection (timeout).') logger.info('Microscope connection established') - atexit.register(self.releaseConnection) + atexit.register(self.release_connection) self.name = name self.FUNCTION_MODES = FUNCTION_MODES @@ -286,7 +286,7 @@ def setDiffShift(self, x, y): self.DiffractionShift_x = x self.DiffractionShift_y = y - def releaseConnection(self): + def release_connection(self): comtypes.CoUninitialize() logger.info('Connection to microscope released') print('Connection to microscope released') diff --git a/src/instamatic/TEMController/jeol_microscope.py b/src/instamatic/TEMController/jeol_microscope.py index e1a4b7aa..d7773bd5 100644 --- a/src/instamatic/TEMController/jeol_microscope.py +++ b/src/instamatic/TEMController/jeol_microscope.py @@ -106,7 +106,7 @@ def __init__(self, name: str = 'jeol'): raise TEMCommunicationError('Cannot establish microscope connection (timeout).') logger.info('Microscope connection established') - atexit.register(self.releaseConnection) + atexit.register(self.release_connection) self._x_direction = 0 self._y_direction = 0 @@ -427,7 +427,7 @@ def getDiffShift(self) -> Tuple[int, int]: def setDiffShift(self, x: int, y: int): self.def3.SetPLA(x, y) - def releaseConnection(self): + def release_connection(self): comtypes.CoUninitialize() logger.info('Connection to microscope released') diff --git a/src/instamatic/TEMController/simu_microscope.py b/src/instamatic/TEMController/simu_microscope.py index 1516590b..a66ff8fb 100644 --- a/src/instamatic/TEMController/simu_microscope.py +++ b/src/instamatic/TEMController/simu_microscope.py @@ -475,7 +475,7 @@ def setDiffShift(self, x: int, y: int): self.DiffractionShift_x = x self.DiffractionShift_y = y - def releaseConnection(self): + def release_connection(self): print('Connection to microscope released') def isBeamBlanked(self) -> bool: diff --git a/src/instamatic/camera/camera.py b/src/instamatic/camera/camera.py index 4b56a0a6..0e811700 100644 --- a/src/instamatic/camera/camera.py +++ b/src/instamatic/camera/camera.py @@ -192,7 +192,7 @@ def main_entry(): if __name__ == '__main__': # main_entry() cam = Camera(use_server=True) - arr = cam.getImage(exposure=0.1) + arr = cam.get_image(exposure=0.1) print(arr) print(arr.shape) diff --git a/src/instamatic/camera/camera_client.py b/src/instamatic/camera/camera_client.py index a75b0f78..e8c02c8a 100644 --- a/src/instamatic/camera/camera_client.py +++ b/src/instamatic/camera/camera_client.py @@ -119,7 +119,7 @@ def _eval_dct(self, dct): """Takes approximately 0.2-0.3 ms per call if HOST=='localhost'.""" self.s.send(dumper(dct)) - acquiring_image = dct['attr_name'] == 'getImage' + acquiring_image = dct['attr_name'] == 'get_image' if acquiring_image and not self.use_shared_memory: response = self.s.recv(self._imagebufsize) diff --git a/src/instamatic/camera/camera_emmenu.py b/src/instamatic/camera/camera_emmenu.py index fd2d7ffc..fa7794ff 100644 --- a/src/instamatic/camera/camera_emmenu.py +++ b/src/instamatic/camera/camera_emmenu.py @@ -122,7 +122,7 @@ def __init__( # print(msg) logger.info(msg) - atexit.register(self.releaseConnection) + atexit.register(self.release_connection) def load_defaults(self) -> None: if self.name != config.settings.camera: @@ -402,7 +402,7 @@ def writeTiffs(self, start_index: int, stop_index: int, path: str, clear_buffer: print(f'Wrote {i+1} images to {path}') - def getImage(self, **kwargs) -> 'np.array': + def get_image(self, **kwargs) -> 'np.array': """Acquire image through EMMENU and return data as np array.""" self._vp.AcquireAndDisplayImage() i = self.get_image_index() @@ -491,7 +491,7 @@ def get_timestamps(self, start_index: int, end_index: int) -> list: timestamps.append(t) return timestamps - def releaseConnection(self) -> None: + def release_connection(self) -> None: """Release the connection to the camera.""" self.stop_liveview() diff --git a/src/instamatic/camera/camera_gatan.py b/src/instamatic/camera/camera_gatan.py index ac35bdc4..dca43895 100644 --- a/src/instamatic/camera/camera_gatan.py +++ b/src/instamatic/camera/camera_gatan.py @@ -139,7 +139,7 @@ def __init__(self, name: str = 'gatan'): # print(f"Dimensions {dim_x}x{dim_y}") # print(f"Info {self.isCameraInfoAvailable()} | Count {self.getCameraCount()}") - atexit.register(self.releaseConnection) + atexit.register(self.release_connection) def load_defaults(self): if self.name != config.settings.camera: @@ -149,7 +149,7 @@ def load_defaults(self): self.streamable = False - def getImage(self, exposure=None, binsize=None, **kwargs) -> np.ndarray: + def get_image(self, exposure=None, binsize=None, **kwargs) -> np.ndarray: """Image acquisition routine. exposure: exposure time in seconds @@ -218,7 +218,7 @@ def establishConnection(self) -> None: if res != 1: raise RuntimeError(f'Could not establish camera connection to {self.name}') - def releaseConnection(self) -> None: + def release_connection(self) -> None: """Release the connection to the camera.""" name = self.getName() self._releaseCCDCOM() diff --git a/src/instamatic/camera/camera_gatan2.py b/src/instamatic/camera/camera_gatan2.py index e757a612..107c96cd 100644 --- a/src/instamatic/camera/camera_gatan2.py +++ b/src/instamatic/camera/camera_gatan2.py @@ -31,7 +31,7 @@ def __init__(self, name: str = 'gatan2'): # print(msg) logger.info(msg) - atexit.register(self.releaseConnection) + atexit.register(self.release_connection) def load_defaults(self) -> None: if self.name != config.settings.camera: @@ -86,11 +86,11 @@ def writeTiffs(self) -> None: print(f'Wrote {i+1} images to {path}') - def getImage(self, - exposure=0.400, - binning=1, - processing='gain normalized', - ) -> 'np.array': + def get_image(self, + exposure=0.400, + binning=1, + processing='gain normalized', + ) -> 'np.array': """Acquire image through DM and return data as np array.""" width, height = self.dimensions @@ -99,23 +99,23 @@ def getImage(self, bottom = height right = width - arr = self.g.getImage(processing=processing, - height=height, - width=width, - binning=binning, - top=top, - left=left, - bottom=bottom, - right=right, - exposure=exposure, - shutterDelay=0, - ) + arr = self.g.get_image(processing=processing, + height=height, + width=width, + binning=binning, + top=top, + left=left, + bottom=bottom, + right=right, + exposure=exposure, + shutterDelay=0, + ) return arr def acquireImage(self, **kwargs) -> 'np.array': """Acquire image through DM.""" - return self.getImage(**kwargs) + return self.get_image(**kwargs) def get_ready_for_record(self) -> None: self.reset_record_vars() @@ -157,7 +157,7 @@ def get_exposure(self) -> int: """Return exposure time in ms.""" raise NotImplementedError - def releaseConnection(self) -> None: + def release_connection(self) -> None: """Release the connection to the camera.""" msg = f'Connection to camera `{self.getCameraName()}` ({self.name}) released' # print(msg) diff --git a/src/instamatic/camera/camera_merlin.py b/src/instamatic/camera/camera_merlin.py index e4ef4ad2..e4f754d5 100644 --- a/src/instamatic/camera/camera_merlin.py +++ b/src/instamatic/camera/camera_merlin.py @@ -16,7 +16,7 @@ cam.merlin_set('COUNTERDEPTH', 12) # acquire single frame (uses soft trigger) -frame = cam.getImage(exposure=0.1) +frame = cam.get_image(exposure=0.1) # acquire multiple frames with gapless acquisition frames = cam.getMovie(n_frames=10, exposure=0.1) @@ -92,7 +92,7 @@ def __init__(self, name='merlin'): msg = f'Camera {self.getName()} initialized' logger.info(msg) - atexit.register(self.releaseConnection) + atexit.register(self.release_connection) def load_defaults(self): if self.name != config.settings.camera: @@ -219,7 +219,7 @@ def teardown_soft_trigger(self): self._soft_trigger_mode = False self._soft_trigger_exposure = None - def getImage(self, exposure: float = None, **kwargs) -> np.ndarray: + def get_image(self, exposure: float = None, **kwargs) -> np.ndarray: """Image acquisition routine. If the exposure is not given, the default value is read from the config file. @@ -403,7 +403,7 @@ def establishDataConnection(self) -> None: self.s_data = s_data - def releaseConnection(self) -> None: + def release_connection(self) -> None: """Release the connection to the camera.""" if self._soft_trigger_mode: logger.info('Stopping acquisition') @@ -449,7 +449,7 @@ def test_single_frame(cam): t0 = time.perf_counter() for i in range(n_frames): - frame = cam.getImage() + frame = cam.get_image() assert frame.shape == (512, 512) t1 = time.perf_counter() @@ -462,7 +462,7 @@ def test_single_frame(cam): def test_plot_single_image(cam): - arr = cam.getImage(exposure=0.1) + arr = cam.get_image(exposure=0.1) import numpy as np diff --git a/src/instamatic/camera/camera_serval.py b/src/instamatic/camera/camera_serval.py index 7e3a26d1..b91ee74e 100644 --- a/src/instamatic/camera/camera_serval.py +++ b/src/instamatic/camera/camera_serval.py @@ -31,7 +31,7 @@ def __init__(self, name='serval'): msg = f'Camera {self.getName()} initialized' logger.info(msg) - atexit.register(self.releaseConnection) + atexit.register(self.release_connection) def load_defaults(self): if self.name != config.settings.camera: @@ -41,7 +41,7 @@ def load_defaults(self): self.__dict__.update(config.camera.mapping) - def getImage(self, exposure=None, binsize=None, **kwargs) -> np.ndarray: + def get_image(self, exposure=None, binsize=None, **kwargs) -> np.ndarray: """Image acquisition routine. If the exposure and binsize are not given, the default values are read from the config file. @@ -144,7 +144,7 @@ def establishConnection(self) -> None: }], } - def releaseConnection(self) -> None: + def release_connection(self) -> None: """Release the connection to the camera.""" self.conn.measurement_stop() name = self.getName() diff --git a/src/instamatic/camera/camera_simu.py b/src/instamatic/camera/camera_simu.py index c1aba801..69c3e184 100644 --- a/src/instamatic/camera/camera_simu.py +++ b/src/instamatic/camera/camera_simu.py @@ -26,7 +26,7 @@ def __init__(self, name='simulate'): msg = f'Camera {self.getName()} initialized' logger.info(msg) - atexit.register(self.releaseConnection) + atexit.register(self.release_connection) # EMMENU variables self._image_index = 0 @@ -42,7 +42,7 @@ def load_defaults(self): self.__dict__.update(config.camera.mapping) - def getImage(self, exposure=None, binsize=None, **kwargs) -> np.ndarray: + def get_image(self, exposure=None, binsize=None, **kwargs) -> np.ndarray: """Image acquisition routine. If the exposure and binsize are not given, the default values are read from the config file. @@ -90,7 +90,7 @@ def getMovie(self, n_frames, *, exposure: float = None, binsize: int = None, **k ------- stack : List[np.ndarray] """ - return [self.getImage(exposure=exposure, binsize=binsize) for _ in range(n_frames)] + return [self.get_image(exposure=exposure, binsize=binsize) for _ in range(n_frames)] def acquireImage(self) -> int: """For TVIPS compatibility.""" @@ -124,7 +124,7 @@ def establishConnection(self) -> None: if res != 1: raise RuntimeError(f'Could not establish camera connection to {self.name}') - def releaseConnection(self) -> None: + def release_connection(self) -> None: """Release the connection to the camera.""" name = self.getName() msg = f"Connection to camera '{name}' released" diff --git a/src/instamatic/camera/camera_timepix.py b/src/instamatic/camera/camera_timepix.py index c8e4e87d..013ba52f 100644 --- a/src/instamatic/camera/camera_timepix.py +++ b/src/instamatic/camera/camera_timepix.py @@ -287,7 +287,7 @@ def acquireData(self, exposure=0.001): return out - def getImage(self, exposure): + def get_image(self, exposure): return self.acquireData(exposure=exposure) def getName(self): diff --git a/src/instamatic/camera/fakevideostream.py b/src/instamatic/camera/fakevideostream.py index bbc0a632..e58c885e 100644 --- a/src/instamatic/camera/fakevideostream.py +++ b/src/instamatic/camera/fakevideostream.py @@ -46,8 +46,8 @@ def __getattr__(self, attrname): except AttributeError: raise reraise_on_fail - def getImage(self, exposure=None, binsize=None): - frame = self.cam.getImage(exposure=exposure, binsize=binsize) + def get_image(self, exposure=None, binsize=None): + frame = self.cam.get_image(exposure=exposure, binsize=binsize) self.frame, scale = autoscale(frame, maxdim=self.display_dim) @@ -87,7 +87,7 @@ def continuous_collection(self, exposure=0.1, n=100, callback=None): while go_on: i += 1 - img = self.getImage(exposure=exposure) + img = self.get_image(exposure=exposure) if callback: go_on = callback(img) diff --git a/src/instamatic/camera/videostream.py b/src/instamatic/camera/videostream.py index 98c322b4..4ed978a1 100644 --- a/src/instamatic/camera/videostream.py +++ b/src/instamatic/camera/videostream.py @@ -49,11 +49,11 @@ def run(self): if self.acquireInitiateEvent.is_set(): self.acquireInitiateEvent.clear() - frame = self.cam.getImage(exposure=self.exposure, binsize=self.binsize) + frame = self.cam.get_image(exposure=self.exposure, binsize=self.binsize) self.callback(frame, acquire=True) elif not self.continuousCollectionEvent.is_set(): - frame = self.cam.getImage(exposure=self.frametime, binsize=self.binsize) + frame = self.cam.get_image(exposure=self.frametime, binsize=self.binsize) self.callback(frame) def start_loop(self): @@ -122,7 +122,7 @@ def setup_grabber(self): atexit.register(grabber.stop) return grabber - def getImage(self, exposure=None, binsize=None): + def get_image(self, exposure=None, binsize=None): current_frametime = self.grabber.frametime # set to 0 to prevent it lagging data acquisition @@ -179,7 +179,7 @@ def continuous_collection(self, exposure=0.1, n=100, callback=None): while go_on: i += 1 - img = self.getImage(exposure=exposure) + img = self.get_image(exposure=exposure) if callback: go_on = callback(img) diff --git a/src/instamatic/server/cam_server.py b/src/instamatic/server/cam_server.py index 06971153..cc11d529 100644 --- a/src/instamatic/server/cam_server.py +++ b/src/instamatic/server/cam_server.py @@ -105,7 +105,7 @@ def run(self): status = 500 else: if self.use_shared_memory: - if attr_name == 'getImage': + if attr_name == 'get_image': self.copy_data_to_shared_buffer(ret) ret = { 'shape': ret.shape, From 451f3dcc70f94a210631bdd3f6986b204b75dec2 Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 09:47:19 +0200 Subject: [PATCH 07/19] snakecase acquireImage --- src/instamatic/camera/camera_emmenu.py | 2 +- src/instamatic/camera/camera_gatan2.py | 2 +- src/instamatic/camera/camera_simu.py | 2 +- src/instamatic/gui/cred_tvips_frame.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/instamatic/camera/camera_emmenu.py b/src/instamatic/camera/camera_emmenu.py index fa7794ff..02b8096e 100644 --- a/src/instamatic/camera/camera_emmenu.py +++ b/src/instamatic/camera/camera_emmenu.py @@ -408,7 +408,7 @@ def get_image(self, **kwargs) -> 'np.array': i = self.get_image_index() return self.getImageDataByIndex(i) - def acquireImage(self, **kwargs) -> int: + def acquire_image(self, **kwargs) -> int: """Acquire image through EMMENU and store in the Image Manager Returns the image index.""" self._vp.AcquireAndDisplayImage() diff --git a/src/instamatic/camera/camera_gatan2.py b/src/instamatic/camera/camera_gatan2.py index 107c96cd..1df3314e 100644 --- a/src/instamatic/camera/camera_gatan2.py +++ b/src/instamatic/camera/camera_gatan2.py @@ -113,7 +113,7 @@ def get_image(self, return arr - def acquireImage(self, **kwargs) -> 'np.array': + def acquire_image(self, **kwargs) -> 'np.array': """Acquire image through DM.""" return self.get_image(**kwargs) diff --git a/src/instamatic/camera/camera_simu.py b/src/instamatic/camera/camera_simu.py index 69c3e184..6ade12f9 100644 --- a/src/instamatic/camera/camera_simu.py +++ b/src/instamatic/camera/camera_simu.py @@ -92,7 +92,7 @@ def getMovie(self, n_frames, *, exposure: float = None, binsize: int = None, **k """ return [self.get_image(exposure=exposure, binsize=binsize) for _ in range(n_frames)] - def acquireImage(self) -> int: + def acquire_image(self) -> int: """For TVIPS compatibility.""" return 1 diff --git a/src/instamatic/gui/cred_tvips_frame.py b/src/instamatic/gui/cred_tvips_frame.py index fb51d4a1..863ef315 100644 --- a/src/instamatic/gui/cred_tvips_frame.py +++ b/src/instamatic/gui/cred_tvips_frame.py @@ -296,7 +296,7 @@ def focus(self): self.ctrl.run_script('focus_mode.py') def get_image(self): - self.ctrl.cam.acquireImage() + self.ctrl.cam.acquire_image() def acquire_data_CRED_TVIPS(controller, **kwargs): From ef07898105f3fae4aa86783742c7ec16c70de31f Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 09:48:11 +0200 Subject: [PATCH 08/19] Snakecase writeTiffs --- src/instamatic/camera/camera_emmenu.py | 2 +- src/instamatic/camera/camera_gatan2.py | 2 +- src/instamatic/camera/camera_simu.py | 2 +- src/instamatic/experiments/cred_tvips/experiment.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/instamatic/camera/camera_emmenu.py b/src/instamatic/camera/camera_emmenu.py index 02b8096e..fd5f8812 100644 --- a/src/instamatic/camera/camera_emmenu.py +++ b/src/instamatic/camera/camera_emmenu.py @@ -376,7 +376,7 @@ def writeTiff(self, image_index, filename: str) -> None: self.writeTiffFromPointer(p, filename) - def writeTiffs(self, start_index: int, stop_index: int, path: str, clear_buffer: bool = False) -> None: + def write_tiffs(self, start_index: int, stop_index: int, path: str, clear_buffer: bool = False) -> None: """Write a series of data in tiff format and writes them to the given `path` using EMMENU machinery.""" path = Path(path) diff --git a/src/instamatic/camera/camera_gatan2.py b/src/instamatic/camera/camera_gatan2.py index 1df3314e..19f68112 100644 --- a/src/instamatic/camera/camera_gatan2.py +++ b/src/instamatic/camera/camera_gatan2.py @@ -76,7 +76,7 @@ def writeTiff(self, filename: str) -> None: """Write tiff file using the DM machinery.""" raise NotImplementedError - def writeTiffs(self) -> None: + def write_tiffs(self) -> None: """Write a series of data in tiff format and writes them to the given `path`""" raise NotImplementedError diff --git a/src/instamatic/camera/camera_simu.py b/src/instamatic/camera/camera_simu.py index 6ade12f9..05749653 100644 --- a/src/instamatic/camera/camera_simu.py +++ b/src/instamatic/camera/camera_simu.py @@ -188,5 +188,5 @@ def get_timestamps(self, start_index, end_index): def getBinning(self): return self.default_binsize - def writeTiffs(self, start_index: int, stop_index: int, path: str, clear_buffer=True) -> None: + def write_tiffs(self, start_index: int, stop_index: int, path: str, clear_buffer=True) -> None: pass diff --git a/src/instamatic/experiments/cred_tvips/experiment.py b/src/instamatic/experiments/cred_tvips/experiment.py index 5e4d51f9..acef5cd9 100644 --- a/src/instamatic/experiments/cred_tvips/experiment.py +++ b/src/instamatic/experiments/cred_tvips/experiment.py @@ -430,7 +430,7 @@ def start_collection(self, target_angle: float, start_angle: float = None, manua path_data = self.path / 'tiff' path_data.mkdir(exist_ok=True, parents=True) - self.emmenu.writeTiffs(start_index, end_index, path=path_data) + self.emmenu.write_tiffs(start_index, end_index, path=path_data) if self.track: # Center crystal position From ada855923d8b5916ad341a11745db504dfd3e113 Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 09:50:07 +0200 Subject: [PATCH 09/19] Snakecase writeTiff --- src/instamatic/camera/camera_emmenu.py | 8 ++++---- src/instamatic/camera/camera_gatan2.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/instamatic/camera/camera_emmenu.py b/src/instamatic/camera/camera_emmenu.py index fd5f8812..ca5cf5b5 100644 --- a/src/instamatic/camera/camera_emmenu.py +++ b/src/instamatic/camera/camera_emmenu.py @@ -363,18 +363,18 @@ def getCameraName(self) -> str: """Get the name reported by the camera.""" return self._cam.name - def writeTiffFromPointer(self, image_pointer, filename: str) -> None: + def write_tiff_from_pointer(self, image_pointer, filename: str) -> None: """Write tiff file using the EMMENU machinery `image_pointer` is the memory address returned by `getImageIndex()`""" self._emf.WriteTiff(image_pointer, filename) - def writeTiff(self, image_index, filename: str) -> None: + def write_tiff(self, image_index, filename: str) -> None: """Write tiff file using the EMMENU machinery `image_index` is the index in the current directory of the image to be written.""" drc_index = self.drc_index p = self.getImageByIndex(image_index, drc_index) - self.writeTiffFromPointer(p, filename) + self.write_tiff_from_pointer(p, filename) def write_tiffs(self, start_index: int, stop_index: int, path: str, clear_buffer: bool = False) -> None: """Write a series of data in tiff format and writes them to the given @@ -394,7 +394,7 @@ def write_tiffs(self, start_index: int, stop_index: int, path: str, clear_buffer # TODO: wrap writeTiff in try/except # writeTiff causes vague error if image does not exist - self.writeTiffFromPointer(p, fn) + self.write_tiff_from_pointer(p, fn) if clear_buffer: # self._immgr.DeleteImageBuffer(drc_index, image_index) # does not work on 3200 diff --git a/src/instamatic/camera/camera_gatan2.py b/src/instamatic/camera/camera_gatan2.py index 19f68112..40ea2454 100644 --- a/src/instamatic/camera/camera_gatan2.py +++ b/src/instamatic/camera/camera_gatan2.py @@ -72,7 +72,7 @@ def getCameraName(self) -> str: """Get the name reported by the camera.""" return self.name - def writeTiff(self, filename: str) -> None: + def write_tiff(self, filename: str) -> None: """Write tiff file using the DM machinery.""" raise NotImplementedError From c9f23978f51d6fbed548fa7eac86e1111c19dc3e Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 09:50:53 +0200 Subject: [PATCH 10/19] Snakecase getCameraName --- src/instamatic/camera/camera_emmenu.py | 6 +++--- src/instamatic/camera/camera_gatan2.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/instamatic/camera/camera_emmenu.py b/src/instamatic/camera/camera_emmenu.py index ca5cf5b5..be8c8de2 100644 --- a/src/instamatic/camera/camera_emmenu.py +++ b/src/instamatic/camera/camera_emmenu.py @@ -118,7 +118,7 @@ def __init__( self.load_defaults() - msg = f'Camera `{self.getCameraName()}` ({self.name}) initialized' + msg = f'Camera `{self.get_camera_name()}` ({self.name}) initialized' # print(msg) logger.info(msg) @@ -359,7 +359,7 @@ def getBinning(self) -> int: assert bin_x == bin_y, 'Binnings differ in X and Y direction! (X: {bin_x} | Y: {bin_y})' return bin_x - def getCameraName(self) -> str: + def get_camera_name(self) -> str: """Get the name reported by the camera.""" return self._cam.name @@ -500,7 +500,7 @@ def release_connection(self) -> None: self.set_image_index(0) # self._immgr.DeleteDirectory(self.drc_index) # bugged in EMMENU 5.0.9.0/5.0.10.0, FIXME later - msg = f'Connection to camera `{self.getCameraName()}` ({self.name}) released' + msg = f'Connection to camera `{self.get_camera_name()}` ({self.name}) released' # print(msg) logger.info(msg) diff --git a/src/instamatic/camera/camera_gatan2.py b/src/instamatic/camera/camera_gatan2.py index 40ea2454..557c8466 100644 --- a/src/instamatic/camera/camera_gatan2.py +++ b/src/instamatic/camera/camera_gatan2.py @@ -27,7 +27,7 @@ def __init__(self, name: str = 'gatan2'): self.load_defaults() - msg = f'Camera `{self.getCameraName()}` ({self.name}) initialized' + msg = f'Camera `{self.get_camera_name()}` ({self.name}) initialized' # print(msg) logger.info(msg) @@ -68,7 +68,7 @@ def getBinning(self) -> int: config.""" raise NotImplementedError - def getCameraName(self) -> str: + def get_camera_name(self) -> str: """Get the name reported by the camera.""" return self.name @@ -159,7 +159,7 @@ def get_exposure(self) -> int: def release_connection(self) -> None: """Release the connection to the camera.""" - msg = f'Connection to camera `{self.getCameraName()}` ({self.name}) released' + msg = f'Connection to camera `{self.get_camera_name()}` ({self.name}) released' # print(msg) logger.info(msg) From 4a3cb196de9518e52cb59024a3b9142ad31e9092 Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 09:51:48 +0200 Subject: [PATCH 11/19] Snakecase getBinning --- docs/examples/montage_processing.ipynb | 2 +- src/instamatic/TEMController/TEMController.py | 2 +- src/instamatic/calibrate/calibrate_stagematrix.py | 2 +- src/instamatic/camera/camera_emmenu.py | 4 ++-- src/instamatic/camera/camera_gatan2.py | 4 ++-- src/instamatic/camera/camera_merlin.py | 2 +- src/instamatic/camera/camera_serval.py | 2 +- src/instamatic/camera/camera_simu.py | 4 ++-- src/instamatic/config/autoconfig.py | 2 +- src/instamatic/experiments/cred_tvips/experiment.py | 2 +- src/instamatic/gridmontage.py | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/examples/montage_processing.ipynb b/docs/examples/montage_processing.ipynb index 346f4a64..0d5e3dd5 100644 --- a/docs/examples/montage_processing.ipynb +++ b/docs/examples/montage_processing.ipynb @@ -319,7 +319,7 @@ " for i, image in enumerate(buffer):\n", " x, y, z, _, _ = stagepos[i]\n", " shape = image.shape\n", - " # binsize = ctrl.cam.getBinning()\n", + " # binsize = ctrl.cam.get_binning()\n", "\n", " d = {}\n", " d['StageXYZ'] = x / 1000, y / 1000, z / 1000\n", diff --git a/src/instamatic/TEMController/TEMController.py b/src/instamatic/TEMController/TEMController.py index 4db17a99..a3cb09b5 100644 --- a/src/instamatic/TEMController/TEMController.py +++ b/src/instamatic/TEMController/TEMController.py @@ -271,7 +271,7 @@ def get_stagematrix(self, binning: int = None, mag: int = None, mode: int = None if not mag: mag = self.magnification.value if not binning: - binning = self.cam.getBinning() + binning = self.cam.get_binning() stagematrix = config.calibration[mode]['stagematrix'][mag] stagematrix = np.array(stagematrix).reshape(2, 2) * binning # um -> nm diff --git a/src/instamatic/calibrate/calibrate_stagematrix.py b/src/instamatic/calibrate/calibrate_stagematrix.py index 5766d84c..b6ba80e6 100644 --- a/src/instamatic/calibrate/calibrate_stagematrix.py +++ b/src/instamatic/calibrate/calibrate_stagematrix.py @@ -158,7 +158,7 @@ def calibrate_stage_from_stageshifts(ctrl, mag = ctrl.magnification.value mode = ctrl.mode.get() - binning = ctrl.cam.getBinning() + binning = ctrl.cam.get_binning() pairs = [] diff --git a/src/instamatic/camera/camera_emmenu.py b/src/instamatic/camera/camera_emmenu.py index be8c8de2..d114dbc9 100644 --- a/src/instamatic/camera/camera_emmenu.py +++ b/src/instamatic/camera/camera_emmenu.py @@ -343,14 +343,14 @@ def getCameraDimensions(self) -> (int, int): def getImageDimensions(self) -> (int, int): """Get the dimensions of the image.""" - binning = self.getBinning() + binning = self.get_binning() return int(self._cam.RealSizeX / binning), int(self._cam.RealSizeY / binning) def getPhysicalPixelsize(self) -> (int, int): """Returns the physical pixel size of the camera nanometers.""" return self._cam.PixelSizeX, self._cam.PixelSizeY - def getBinning(self) -> int: + def get_binning(self) -> int: """Returns the binning corresponding to the currently selected camera config.""" cfg = self.getCurrentConfig(as_dict=False) diff --git a/src/instamatic/camera/camera_gatan2.py b/src/instamatic/camera/camera_gatan2.py index 557c8466..64aa7059 100644 --- a/src/instamatic/camera/camera_gatan2.py +++ b/src/instamatic/camera/camera_gatan2.py @@ -55,7 +55,7 @@ def getCameraDimensions(self) -> (int, int): def getImageDimensions(self) -> (int, int): """Get the dimensions of the image.""" - binning = self.getBinning() + binning = self.get_binning() dim_x, dim_y = self.getCameraDimensions() return int(dim_x / binning), int(dim_y / binning) @@ -63,7 +63,7 @@ def getPhysicalPixelsize(self) -> (int, int): """Returns the physical pixel size of the camera nanometers.""" raise NotImplementedError - def getBinning(self) -> int: + def get_binning(self) -> int: """Returns the binning corresponding to the currently selected camera config.""" raise NotImplementedError diff --git a/src/instamatic/camera/camera_merlin.py b/src/instamatic/camera/camera_merlin.py index e4f754d5..f8aa4de1 100644 --- a/src/instamatic/camera/camera_merlin.py +++ b/src/instamatic/camera/camera_merlin.py @@ -344,7 +344,7 @@ def isCameraInfoAvailable(self) -> bool: def getImageDimensions(self) -> (int, int): """Get the binned dimensions reported by the camera.""" - binning = self.getBinning() + binning = self.get_binning() dim_x, dim_y = self.getCameraDimensions() dim_x = int(dim_x / binning) diff --git a/src/instamatic/camera/camera_serval.py b/src/instamatic/camera/camera_serval.py index b91ee74e..09952090 100644 --- a/src/instamatic/camera/camera_serval.py +++ b/src/instamatic/camera/camera_serval.py @@ -100,7 +100,7 @@ def getMovie(self, n_frames, exposure=None, binsize=None, **kwargs): def getImageDimensions(self) -> (int, int): """Get the binned dimensions reported by the camera.""" - binning = self.getBinning() + binning = self.get_binning() dim_x, dim_y = self.getCameraDimensions() dim_x = int(dim_x / binning) diff --git a/src/instamatic/camera/camera_simu.py b/src/instamatic/camera/camera_simu.py index 05749653..52af4002 100644 --- a/src/instamatic/camera/camera_simu.py +++ b/src/instamatic/camera/camera_simu.py @@ -102,7 +102,7 @@ def isCameraInfoAvailable(self) -> bool: def getImageDimensions(self) -> (int, int): """Get the binned dimensions reported by the camera.""" - binning = self.getBinning() + binning = self.get_binning() dim_x, dim_y = self.getCameraDimensions() dim_x = int(dim_x / binning) @@ -185,7 +185,7 @@ def get_exposure(self) -> int: def get_timestamps(self, start_index, end_index): return list(range(20)) - def getBinning(self): + def get_binning(self): return self.default_binsize def write_tiffs(self, start_index: int, stop_index: int, path: str, clear_buffer=True) -> None: diff --git a/src/instamatic/config/autoconfig.py b/src/instamatic/config/autoconfig.py index 907d57d6..44dcb7fa 100644 --- a/src/instamatic/config/autoconfig.py +++ b/src/instamatic/config/autoconfig.py @@ -14,7 +14,7 @@ def get_tvips_calibs(ctrl, rng: list, mode: str, wavelength: float) -> dict: calib_range = {} - binning = ctrl.cam.getBinning() + binning = ctrl.cam.get_binning() ctrl.mode.set(mode) diff --git a/src/instamatic/experiments/cred_tvips/experiment.py b/src/instamatic/experiments/cred_tvips/experiment.py index acef5cd9..7a95e0d2 100644 --- a/src/instamatic/experiments/cred_tvips/experiment.py +++ b/src/instamatic/experiments/cred_tvips/experiment.py @@ -463,7 +463,7 @@ def log_end_status(self): physical_pixelsize = config.camera.physical_pixelsize # mm - binning = self.emmenu.getBinning() + binning = self.emmenu.get_binning() image_dimensions_x, image_dimensions_y = self.emmenu.getImageDimensions() camera_dimensions_x, camera_dimensions_y = self.emmenu.getCameraDimensions() diff --git a/src/instamatic/gridmontage.py b/src/instamatic/gridmontage.py index 03b02e88..44569001 100644 --- a/src/instamatic/gridmontage.py +++ b/src/instamatic/gridmontage.py @@ -57,7 +57,7 @@ def setup(self, self.overlap = overlap if not binning: - binning = self.ctrl.cam.getBinning() + binning = self.ctrl.cam.get_binning() res_x, res_y = self.ctrl.cam.getImageDimensions() From 827aff7a41596cc8ac2960212af620574cbc02b0 Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 09:55:36 +0200 Subject: [PATCH 12/19] Snakecase get{Image,Camera}Dimensions --- src/instamatic/TEMController/TEMController.py | 2 +- src/instamatic/calibrate/calibrate_beamshift.py | 2 +- src/instamatic/calibrate/calibrate_stagematrix.py | 2 +- src/instamatic/camera/camera_client.py | 2 +- src/instamatic/camera/camera_emmenu.py | 6 +++--- src/instamatic/camera/camera_gatan.py | 4 ++-- src/instamatic/camera/camera_gatan2.py | 8 ++++---- src/instamatic/camera/camera_merlin.py | 6 +++--- src/instamatic/camera/camera_serval.py | 6 +++--- src/instamatic/camera/camera_simu.py | 8 ++++---- src/instamatic/camera/camera_timepix.py | 4 ++-- src/instamatic/experiments/autocred/experiment.py | 2 +- src/instamatic/experiments/cred_tvips/experiment.py | 4 ++-- src/instamatic/experiments/serialed/experiment.py | 2 +- src/instamatic/gridmontage.py | 2 +- tests/test_camera.py | 2 +- 16 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/instamatic/TEMController/TEMController.py b/src/instamatic/TEMController/TEMController.py index a3cb09b5..1de98d3c 100644 --- a/src/instamatic/TEMController/TEMController.py +++ b/src/instamatic/TEMController/TEMController.py @@ -645,7 +645,7 @@ def get_image(self, # k['ImageRotation'] = config.calibration[mode]['rotation'][mag] h['ImageComment'] = comment h['ImageCameraName'] = self.cam.name - h['ImageCameraDimensions'] = self.cam.getCameraDimensions() + h['ImageCameraDimensions'] = self.cam.get_camera_dimensions() if verbose: print(f'Image acquired - shape: {arr.shape}, size: {arr.nbytes / 1024:.0f} kB') diff --git a/src/instamatic/calibrate/calibrate_beamshift.py b/src/instamatic/calibrate/calibrate_beamshift.py index ac8e41d6..de72e28e 100644 --- a/src/instamatic/calibrate/calibrate_beamshift.py +++ b/src/instamatic/calibrate/calibrate_beamshift.py @@ -105,7 +105,7 @@ def plot(self, to_file=None, outdir=''): def center(self, ctrl): """Return beamshift values to center the beam in the frame.""" - pixel_center = [val / 2.0 for val in ctrl.cam.getImageDimensions()] + pixel_center = [val / 2.0 for val in ctrl.cam.get_image_dimensions()] beamshift = self.pixelcoord_to_beamshift(pixel_center) if ctrl: diff --git a/src/instamatic/calibrate/calibrate_stagematrix.py b/src/instamatic/calibrate/calibrate_stagematrix.py index b6ba80e6..01abc311 100644 --- a/src/instamatic/calibrate/calibrate_stagematrix.py +++ b/src/instamatic/calibrate/calibrate_stagematrix.py @@ -293,7 +293,7 @@ def calibrate_stage(ctrl, print(f'\nCalibrating stagematrix mode=`{mode}` mag={mag}\n') - camera_shape = ctrl.cam.getCameraDimensions() + camera_shape = ctrl.cam.get_camera_dimensions() pixelsize = config.calibration[mode]['pixelsize'][mag] if pixelsize == 1.0 or pixelsize == 0.0: diff --git a/src/instamatic/camera/camera_client.py b/src/instamatic/camera/camera_client.py index e8c02c8a..a327b1f8 100644 --- a/src/instamatic/camera/camera_client.py +++ b/src/instamatic/camera/camera_client.py @@ -83,7 +83,7 @@ def __init__( atexit.register(self.s.close) - xres, yres = self.getImageDimensions() + xres, yres = self.get_image_dimensions() bitdepth = 4 self._imagebufsize = bitdepth * xres * yres + self._bufsize diff --git a/src/instamatic/camera/camera_emmenu.py b/src/instamatic/camera/camera_emmenu.py index d114dbc9..3e6c3302 100644 --- a/src/instamatic/camera/camera_emmenu.py +++ b/src/instamatic/camera/camera_emmenu.py @@ -334,19 +334,19 @@ def getImageDataByIndex(self, img_index: int, drc_index: int = None) -> 'np.arra return np.array(arr) - def getCameraDimensions(self) -> (int, int): + def get_camera_dimensions(self) -> (int, int): """Get the maximum dimensions reported by the camera.""" # cfg = self.getCurrentConfig() # return cfg.DimensionX, cfg.DimensionY return self._cam.RealSizeX, self._cam.RealSizeY # return self._cam.MaximumSizeX, self._cam.MaximumSizeY - def getImageDimensions(self) -> (int, int): + def get_image_dimensions(self) -> (int, int): """Get the dimensions of the image.""" binning = self.get_binning() return int(self._cam.RealSizeX / binning), int(self._cam.RealSizeY / binning) - def getPhysicalPixelsize(self) -> (int, int): + def get_physical_pixelsize(self) -> (int, int): """Returns the physical pixel size of the camera nanometers.""" return self._cam.PixelSizeX, self._cam.PixelSizeY diff --git a/src/instamatic/camera/camera_gatan.py b/src/instamatic/camera/camera_gatan.py index dca43895..fbf4e5c8 100644 --- a/src/instamatic/camera/camera_gatan.py +++ b/src/instamatic/camera/camera_gatan.py @@ -135,7 +135,7 @@ def __init__(self, name: str = 'gatan'): msg = f'Camera {self.getName()} initialized' logger.info(msg) - # dim_x, dim_y = self.getImageDimensions() + # dim_x, dim_y = self.get_image_dimensions() # print(f"Dimensions {dim_x}x{dim_y}") # print(f"Info {self.isCameraInfoAvailable()} | Count {self.getCameraCount()}") @@ -199,7 +199,7 @@ def isCameraInfoAvailable(self) -> bool: """Return the status of the camera.""" return self._isCameraInfoAvailable() - def getCameraDimensions(self) -> (int, int): + def get_camera_dimensions(self) -> (int, int): """Return the dimensions reported by the camera.""" pnWidth = c_int(0) pnHeight = c_int(0) diff --git a/src/instamatic/camera/camera_gatan2.py b/src/instamatic/camera/camera_gatan2.py index 64aa7059..de0ae80e 100644 --- a/src/instamatic/camera/camera_gatan2.py +++ b/src/instamatic/camera/camera_gatan2.py @@ -49,17 +49,17 @@ def getDMVersion(self) -> str: """Get the version number of DM.""" return self.g.GetDMVersion() - def getCameraDimensions(self) -> (int, int): + def get_camera_dimensions(self) -> (int, int): """Get the maximum dimensions reported by the camera.""" raise NotImplementedError - def getImageDimensions(self) -> (int, int): + def get_image_dimensions(self) -> (int, int): """Get the dimensions of the image.""" binning = self.get_binning() - dim_x, dim_y = self.getCameraDimensions() + dim_x, dim_y = self.get_camera_dimensions() return int(dim_x / binning), int(dim_y / binning) - def getPhysicalPixelsize(self) -> (int, int): + def get_physical_pixelsize(self) -> (int, int): """Returns the physical pixel size of the camera nanometers.""" raise NotImplementedError diff --git a/src/instamatic/camera/camera_merlin.py b/src/instamatic/camera/camera_merlin.py index f8aa4de1..e5070aae 100644 --- a/src/instamatic/camera/camera_merlin.py +++ b/src/instamatic/camera/camera_merlin.py @@ -342,17 +342,17 @@ def isCameraInfoAvailable(self) -> bool: """Check if the camera is available.""" return True - def getImageDimensions(self) -> (int, int): + def get_image_dimensions(self) -> (int, int): """Get the binned dimensions reported by the camera.""" binning = self.get_binning() - dim_x, dim_y = self.getCameraDimensions() + dim_x, dim_y = self.get_camera_dimensions() dim_x = int(dim_x / binning) dim_y = int(dim_y / binning) return dim_x, dim_y - def getCameraDimensions(self) -> (int, int): + def get_camera_dimensions(self) -> (int, int): """Get the dimensions reported by the camera.""" return self.dimensions diff --git a/src/instamatic/camera/camera_serval.py b/src/instamatic/camera/camera_serval.py index 09952090..a0f9c212 100644 --- a/src/instamatic/camera/camera_serval.py +++ b/src/instamatic/camera/camera_serval.py @@ -98,17 +98,17 @@ def getMovie(self, n_frames, exposure=None, binsize=None, **kwargs): return arr - def getImageDimensions(self) -> (int, int): + def get_image_dimensions(self) -> (int, int): """Get the binned dimensions reported by the camera.""" binning = self.get_binning() - dim_x, dim_y = self.getCameraDimensions() + dim_x, dim_y = self.get_camera_dimensions() dim_x = int(dim_x / binning) dim_y = int(dim_y / binning) return dim_x, dim_y - def getCameraDimensions(self) -> (int, int): + def get_camera_dimensions(self) -> (int, int): """Get the dimensions reported by the camera.""" return self.dimensions diff --git a/src/instamatic/camera/camera_simu.py b/src/instamatic/camera/camera_simu.py index 52af4002..084a8a17 100644 --- a/src/instamatic/camera/camera_simu.py +++ b/src/instamatic/camera/camera_simu.py @@ -62,7 +62,7 @@ def get_image(self, exposure=None, binsize=None, **kwargs) -> np.ndarray: if not binsize: binsize = self.default_binsize - dim_x, dim_y = self.getCameraDimensions() + dim_x, dim_y = self.get_camera_dimensions() dim_x = int(dim_x / binsize) dim_y = int(dim_y / binsize) @@ -100,17 +100,17 @@ def isCameraInfoAvailable(self) -> bool: """Check if the camera is available.""" return True - def getImageDimensions(self) -> (int, int): + def get_image_dimensions(self) -> (int, int): """Get the binned dimensions reported by the camera.""" binning = self.get_binning() - dim_x, dim_y = self.getCameraDimensions() + dim_x, dim_y = self.get_camera_dimensions() dim_x = int(dim_x / binning) dim_y = int(dim_y / binning) return dim_x, dim_y - def getCameraDimensions(self) -> (int, int): + def get_camera_dimensions(self) -> (int, int): """Get the dimensions reported by the camera.""" return self.dimensions diff --git a/src/instamatic/camera/camera_timepix.py b/src/instamatic/camera/camera_timepix.py index 013ba52f..b41fe502 100644 --- a/src/instamatic/camera/camera_timepix.py +++ b/src/instamatic/camera/camera_timepix.py @@ -293,7 +293,7 @@ def get_image(self, exposure): def getName(self): return 'timepix' - def getCameraDimensions(self) -> (int, int): + def get_camera_dimensions(self) -> (int, int): return self.dimensions def load_defaults(self): @@ -332,7 +332,7 @@ def initialize(config, name='pytimepix'): cam.readPixelsCfg(pixelsCfg) cam.readRealDacs(realDacs) - print(f'Camera {cam.getName()} initialized (resolution: {cam.getCameraDimensions()})') + print(f'Camera {cam.getName()} initialized (resolution: {cam.get_camera_dimensions()})') return cam diff --git a/src/instamatic/experiments/autocred/experiment.py b/src/instamatic/experiments/autocred/experiment.py index 72bef4dd..745b3ff9 100644 --- a/src/instamatic/experiments/autocred/experiment.py +++ b/src/instamatic/experiments/autocred/experiment.py @@ -992,7 +992,7 @@ def update_referencepoint_bs(self, bs, br): def raster_scan(self): from instamatic.experiments.serialed.experiment import get_offsets_in_scan_area pixelsize_mag1 = config.calibration['mag1']['pixelsize'][self.magnification] / 1000 # nm -> um - xdim, ydim = self.ctrl.getCameraDimensions() + xdim, ydim = self.ctrl.cam.get_camera_dimensions() box_x, box_y = self.pixelsize_mag1 * xdim, self.pixelsize_mag1 * ydim # Make negative to reflect config change 2019-07-03 to make omega more in line with other software diff --git a/src/instamatic/experiments/cred_tvips/experiment.py b/src/instamatic/experiments/cred_tvips/experiment.py index 7a95e0d2..3482c696 100644 --- a/src/instamatic/experiments/cred_tvips/experiment.py +++ b/src/instamatic/experiments/cred_tvips/experiment.py @@ -464,8 +464,8 @@ def log_end_status(self): physical_pixelsize = config.camera.physical_pixelsize # mm binning = self.emmenu.get_binning() - image_dimensions_x, image_dimensions_y = self.emmenu.getImageDimensions() - camera_dimensions_x, camera_dimensions_y = self.emmenu.getCameraDimensions() + image_dimensions_x, image_dimensions_y = self.emmenu.get_image_dimensions() + camera_dimensions_x, camera_dimensions_y = self.emmenu.get_camera_dimensions() pixelsize *= binning physical_pixelsize *= binning diff --git a/src/instamatic/experiments/serialed/experiment.py b/src/instamatic/experiments/serialed/experiment.py index e52b8acb..6ccd3a63 100644 --- a/src/instamatic/experiments/serialed/experiment.py +++ b/src/instamatic/experiments/serialed/experiment.py @@ -213,7 +213,7 @@ def load_calibration(self, **kwargs): self.log.info('Brightness=%s', self.ctrl.brightness) self.pixelsize_mag1 = config.calibration['mag1']['pixelsize'][self.magnification] / 1000 # nm -> um - xdim, ydim = self.ctrl.cam.getCameraDimensions() + xdim, ydim = self.ctrl.cam.get_camera_dimensions() self.image_dimensions = self.pixelsize_mag1 * xdim, self.pixelsize_mag1 * ydim self.log.info('Image dimensions %s', self.image_dimensions) diff --git a/src/instamatic/gridmontage.py b/src/instamatic/gridmontage.py index 44569001..9fe40937 100644 --- a/src/instamatic/gridmontage.py +++ b/src/instamatic/gridmontage.py @@ -59,7 +59,7 @@ def setup(self, if not binning: binning = self.ctrl.cam.get_binning() - res_x, res_y = self.ctrl.cam.getImageDimensions() + res_x, res_y = self.ctrl.cam.get_image_dimensions() overlap_x = int(res_x * overlap) overlap_y = int(res_y * overlap) diff --git a/tests/test_camera.py b/tests/test_camera.py index e0bf6c0a..e3fde796 100644 --- a/tests/test_camera.py +++ b/tests/test_camera.py @@ -19,6 +19,6 @@ def test_get_image(ctrl): def test_functions(ctrl): - dims = ctrl.cam.getImageDimensions() + dims = ctrl.cam.get_image_dimensions() assert isinstance(dims, tuple) assert len(dims) == 2 From 846d323b79428fccdb437887793b8ccae6f71689 Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 10:01:15 +0200 Subject: [PATCH 13/19] Snakecase emmenu methods --- src/instamatic/camera/camera_emmenu.py | 52 +++++++++---------- src/instamatic/camera/camera_gatan2.py | 4 +- src/instamatic/camera/camera_simu.py | 6 +-- src/instamatic/config/autoconfig.py | 4 +- .../experiments/cred_gatan/experiment.py | 4 +- .../experiments/cred_tvips/experiment.py | 6 +-- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/instamatic/camera/camera_emmenu.py b/src/instamatic/camera/camera_emmenu.py index 3e6c3302..85284022 100644 --- a/src/instamatic/camera/camera_emmenu.py +++ b/src/instamatic/camera/camera_emmenu.py @@ -104,7 +104,7 @@ def __init__( # check if exists if not self._immgr.DirectoryExist(self.top_drc_index, drc_name): - if self.getEMMenuVersion().startswith('4.'): + if self.get_emmenu_version().startswith('4.'): self._immgr.CreateNewSubDirectory(self.top_drc_index, drc_name, 2, 2) else: # creating new subdirectories is bugged in EMMENU 5.0.9.0/5.0.10.0 @@ -132,7 +132,7 @@ def load_defaults(self) -> None: self.streamable = False - def listConfigs(self) -> list: + def list_configs(self) -> list: """List the configs from the Configuration Manager.""" print(f'Configurations for camera {self.name}') current = self._vp.Configuration @@ -147,13 +147,13 @@ def listConfigs(self) -> list: return lst - def getCurrentConfigName(self) -> str: + def get_current_config_name(self) -> str: """Return the name of the currently selected configuration in EMMENU.""" - cfg = self.getCurrentConfig(as_dict=False) + cfg = self.get_current_config(as_dict=False) return cfg.Name - def getCurrentConfig(self, as_dict: bool = True) -> dict: + def get_current_config(self, as_dict: bool = True) -> dict: """Get selected config object currently associated with the viewport.""" vp_cfg_name = self._vp.Configuration @@ -214,15 +214,15 @@ def getCurrentConfig(self, as_dict: bool = True) -> dict: else: return cfg - def selectConfig(self) -> None: + def select_config(self) -> None: """Select config by name.""" - cfgs = self.listConfigs() + cfgs = self.list_configs() if config not in cfgs: raise ValueError(f'No such config: {config} -> must be one of {cfgs}') raise NotImplementedError - def getCurrentCameraInfo(self) -> dict: + def get_current_camera_info(self) -> dict: """Gets the current camera object.""" cam = self._cam @@ -242,12 +242,12 @@ def getCurrentCameraInfo(self) -> dict: d['CamCGroup'] = cam.CamCGroup # int return d - def getCameraType(self) -> str: + def get_camera_type(self) -> str: """Get the name of the camera currently in use.""" - cfg = self.getCurrentConfig(as_dict=False) + cfg = self.get_current_config(as_dict=False) return cfg.CameraType - def getEMMenuVersion(self) -> str: + def get_emmenu_version(self) -> str: """Get the version number of EMMENU.""" return self._obj.EMMENUVersion @@ -265,7 +265,7 @@ def unlock(self) -> None: """Unlock emmenu after it has been locked down with `self.lock`""" self._obj.EnableMainframe(0) - def listDirectories(self) -> dict: + def list_directories(self) -> dict: """List subdirectories of the top directory.""" top_j = self._immgr.TopDirectory top_name = self._immgr.FullDirectoryName(top_j) @@ -285,14 +285,14 @@ def listDirectories(self) -> dict: return d - def getEMVectorByIndex(self, img_index: int, drc_index: int = None) -> dict: + def get_emvector_by_index(self, img_index: int, drc_index: int = None) -> dict: """Returns the EMVector by index as a python dictionary.""" - p = self.getImageByIndex(img_index, drc_index) + p = self.get_image_by_index(img_index, drc_index) v = p.EMVector d = EMVector2dict(v) return d - def deleteAllImages(self) -> None: + def delete_all_images(self) -> None: """Clears all images currently stored in EMMENU buffers.""" for i, p in enumerate(self._emi): try: @@ -301,12 +301,12 @@ def deleteAllImages(self) -> None: # sometimes EMMenu also loses track of image pointers... print(f'Failed to delete buffer {i} ({p})') - def deleteImageByIndex(self, img_index: int, drc_index: int = None) -> int: + def delete_image_by_index(self, img_index: int, drc_index: int = None) -> int: """Delete the image from EMMENU by its index.""" - p = self.getImageByIndex(img_index, drc_index) + p = self.get_image_by_index(img_index, drc_index) self._emi.DeleteImage(p) # alternative: self._emi.Remove(p.ImgHandle) - def getImageByIndex(self, img_index: int, drc_index: int = None) -> int: + def get_image_by_index(self, img_index: int, drc_index: int = None) -> int: """Grab data from the image manager by index. Return image pointer (COM). @@ -319,12 +319,12 @@ def getImageByIndex(self, img_index: int, drc_index: int = None) -> int: return p - def getImageDataByIndex(self, img_index: int, drc_index: int = None) -> 'np.array': + def get_image_data_by_index(self, img_index: int, drc_index: int = None) -> 'np.array': """Grab data from the image manager by index. Return numpy 2D array """ - p = self.getImageByIndex(img_index, drc_index) + p = self.get_image_by_index(img_index, drc_index) tpe = p.DataType method = type_dict[tpe] @@ -336,7 +336,7 @@ def getImageDataByIndex(self, img_index: int, drc_index: int = None) -> 'np.arra def get_camera_dimensions(self) -> (int, int): """Get the maximum dimensions reported by the camera.""" - # cfg = self.getCurrentConfig() + # cfg = self.get_current_config() # return cfg.DimensionX, cfg.DimensionY return self._cam.RealSizeX, self._cam.RealSizeY # return self._cam.MaximumSizeX, self._cam.MaximumSizeY @@ -353,7 +353,7 @@ def get_physical_pixelsize(self) -> (int, int): def get_binning(self) -> int: """Returns the binning corresponding to the currently selected camera config.""" - cfg = self.getCurrentConfig(as_dict=False) + cfg = self.get_current_config(as_dict=False) bin_x = cfg.BinningX bin_y = cfg.BinningY assert bin_x == bin_y, 'Binnings differ in X and Y direction! (X: {bin_x} | Y: {bin_y})' @@ -372,7 +372,7 @@ def write_tiff(self, image_index, filename: str) -> None: """Write tiff file using the EMMENU machinery `image_index` is the index in the current directory of the image to be written.""" drc_index = self.drc_index - p = self.getImageByIndex(image_index, drc_index) + p = self.get_image_by_index(image_index, drc_index) self.write_tiff_from_pointer(p, filename) @@ -386,7 +386,7 @@ def write_tiffs(self, start_index: int, stop_index: int, path: str, clear_buffer raise IndexError(f'`stop_index`: {stop_index} >= `start_index`: {start_index}') for i, image_index in enumerate(range(start_index, stop_index + 1)): - p = self.getImageByIndex(image_index, drc_index) + p = self.get_image_by_index(image_index, drc_index) fn = str(path / f'{i:04d}.tiff') print(f'Image #{image_index} -> {fn}') @@ -406,7 +406,7 @@ def get_image(self, **kwargs) -> 'np.array': """Acquire image through EMMENU and return data as np array.""" self._vp.AcquireAndDisplayImage() i = self.get_image_index() - return self.getImageDataByIndex(i) + return self.get_image_data_by_index(i) def acquire_image(self, **kwargs) -> int: """Acquire image through EMMENU and store in the Image Manager Returns @@ -486,7 +486,7 @@ def get_timestamps(self, start_index: int, end_index: int) -> list: drc_index = self.drc_index timestamps = [] for i, image_index in enumerate(range(start_index, end_index + 1)): - p = self.getImageByIndex(image_index, drc_index) + p = self.get_image_by_index(image_index, drc_index) t = p.EMVector.lImgCreationTime timestamps.append(t) return timestamps diff --git a/src/instamatic/camera/camera_gatan2.py b/src/instamatic/camera/camera_gatan2.py index de0ae80e..cdefc84d 100644 --- a/src/instamatic/camera/camera_gatan2.py +++ b/src/instamatic/camera/camera_gatan2.py @@ -41,11 +41,11 @@ def load_defaults(self) -> None: self.streamable = False - def getCameraType(self) -> str: + def get_camera_type(self) -> str: """Get the name of the camera currently in use.""" raise NotImplementedError - def getDMVersion(self) -> str: + def get_dm_version(self) -> str: """Get the version number of DM.""" return self.g.GetDMVersion() diff --git a/src/instamatic/camera/camera_simu.py b/src/instamatic/camera/camera_simu.py index 084a8a17..a095448c 100644 --- a/src/instamatic/camera/camera_simu.py +++ b/src/instamatic/camera/camera_simu.py @@ -132,13 +132,13 @@ def release_connection(self) -> None: # Mimic EMMENU API - def getEMMenuVersion(self) -> str: + def get_emmenu_version(self) -> str: return 'simu' - def getCameraType(self) -> str: + def get_camera_type(self) -> str: return 'SimuType' - def getCurrentConfigName(self) -> str: + def get_current_config_name(self) -> str: return 'SimuCfg' def set_autoincrement(self, value): diff --git a/src/instamatic/config/autoconfig.py b/src/instamatic/config/autoconfig.py index 44dcb7fa..101a402c 100644 --- a/src/instamatic/config/autoconfig.py +++ b/src/instamatic/config/autoconfig.py @@ -20,11 +20,11 @@ def get_tvips_calibs(ctrl, rng: list, mode: str, wavelength: float) -> dict: for i, mag in enumerate(rng): ctrl.magnification.index = i - d = ctrl.cam.getCurrentCameraInfo() + d = ctrl.cam.get_current_camera_info() img = ctrl.get_image(exposure=10) # set to minimum allowed value index = ctrl.cam.get_image_index() - v = ctrl.cam.getEMVectorByIndex(index) + v = ctrl.cam.get_emvector_by_index(index) PixelSizeX = v['fImgDistX'] PixelSizeY = v['fImgDistY'] diff --git a/src/instamatic/experiments/cred_gatan/experiment.py b/src/instamatic/experiments/cred_gatan/experiment.py index 11c83bcc..b9b2dc8d 100644 --- a/src/instamatic/experiments/cred_gatan/experiment.py +++ b/src/instamatic/experiments/cred_gatan/experiment.py @@ -332,10 +332,10 @@ def log_end_status(self): print(f'Rotation speed: {self.rotation_speed:.3f} degrees/s') with open(self.path / 'cRED_log.txt', 'w') as f: - print(f'Program: {instamatic.__long_title__} + GMS {self.cam.getDMVersion()}', file=f) + print(f'Program: {instamatic.__long_title__} + GMS {self.cam.get_dm_version()}', file=f) print(f'Camera: {config.camera.name}', file=f) print(f'Microscope: {config.microscope.name}', file=f) - # print(f"Camera type: {self.cam.getCameraType()}", file=f) + # print(f"Camera type: {self.cam.get_camera_type()}", file=f) print(f'Mode: {self.mode}', file=f) print(f'Data Collection Time: {self.now}', file=f) print(f'Time Period Start: {self.t_start}', file=f) diff --git a/src/instamatic/experiments/cred_tvips/experiment.py b/src/instamatic/experiments/cred_tvips/experiment.py index 3482c696..7fd95a8c 100644 --- a/src/instamatic/experiments/cred_tvips/experiment.py +++ b/src/instamatic/experiments/cred_tvips/experiment.py @@ -478,11 +478,11 @@ def log_end_status(self): print(f'Rotation speed: {self.rotation_speed:.3f} degrees/s') with open(self.path / 'cRED_log.txt', 'w') as f: - print(f'Program: {instamatic.__long_title__} + EMMenu {self.emmenu.getEMMenuVersion()}', file=f) + print(f'Program: {instamatic.__long_title__} + EMMenu {self.emmenu.get_emmenu_version()}', file=f) print(f'Camera: {config.camera.name}', file=f) print(f'Microscope: {config.microscope.name}', file=f) - print(f'Camera type: {self.emmenu.getCameraType()}', file=f) - print(f'Camera config: {self.emmenu.getCurrentConfigName()}', file=f) + print(f'Camera type: {self.emmenu.get_camera_type()}', file=f) + print(f'Camera config: {self.emmenu.get_current_config_name()}', file=f) print(f'Mode: {self.mode}', file=f) print(f'Data Collection Time: {self.now}', file=f) print(f'Time Period Start: {self.t_start}', file=f) From f58d1296c2ca8ff0ac8f03e2df2066e82e4c62c7 Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 10:08:08 +0200 Subject: [PATCH 14/19] Snakecase more methods --- src/instamatic/camera/camera_gatan.py | 14 +++++++------- src/instamatic/camera/camera_merlin.py | 18 +++++++----------- src/instamatic/camera/camera_serval.py | 10 +++++----- src/instamatic/camera/camera_simu.py | 12 ++++++------ src/instamatic/camera/camera_timepix.py | 6 +++--- 5 files changed, 28 insertions(+), 32 deletions(-) diff --git a/src/instamatic/camera/camera_gatan.py b/src/instamatic/camera/camera_gatan.py index fbf4e5c8..3b8ddddb 100644 --- a/src/instamatic/camera/camera_gatan.py +++ b/src/instamatic/camera/camera_gatan.py @@ -128,16 +128,16 @@ def __init__(self, name: str = 'gatan'): self._releaseCCDCOM = getattr(lib, symbols['releaseCCDCOM']) - self.establishConnection() + self.establish_connection() self.load_defaults() - msg = f'Camera {self.getName()} initialized' + msg = f'Camera {self.get_name()} initialized' logger.info(msg) # dim_x, dim_y = self.get_image_dimensions() # print(f"Dimensions {dim_x}x{dim_y}") - # print(f"Info {self.isCameraInfoAvailable()} | Count {self.getCameraCount()}") + # print(f"Info {self.is_camera_info_available()} | Count {self.getCameraCount()}") atexit.register(self.release_connection) @@ -195,7 +195,7 @@ def get_image(self, exposure=None, binsize=None, **kwargs) -> np.ndarray: return arr - def isCameraInfoAvailable(self) -> bool: + def is_camera_info_available(self) -> bool: """Return the status of the camera.""" return self._isCameraInfoAvailable() @@ -206,13 +206,13 @@ def get_camera_dimensions(self) -> (int, int): self._cameraDimensions(byref(pnWidth), byref(pnHeight)) return pnWidth.value, pnHeight.value - def getName(self) -> str: + def get_name(self) -> str: """Return the name reported by the camera.""" buf = create_unicode_buffer(20) self._cameraName(buf, 20) return buf.value - def establishConnection(self) -> None: + def establish_connection(self) -> None: """Establish connection to the camera.""" res = self._initCCDCOM(20120101) if res != 1: @@ -220,7 +220,7 @@ def establishConnection(self) -> None: def release_connection(self) -> None: """Release the connection to the camera.""" - name = self.getName() + name = self.get_name() self._releaseCCDCOM() msg = f'Connection to camera {name} released' logger.info(msg) diff --git a/src/instamatic/camera/camera_merlin.py b/src/instamatic/camera/camera_merlin.py index e5070aae..11da1d1a 100644 --- a/src/instamatic/camera/camera_merlin.py +++ b/src/instamatic/camera/camera_merlin.py @@ -86,10 +86,10 @@ def __init__(self, name='merlin'): self.load_defaults() - self.establishConnection() - self.establishDataConnection() + self.establish_connection() + self.establish_data_connection() - msg = f'Camera {self.getName()} initialized' + msg = f'Camera {self.get_name()} initialized' logger.info(msg) atexit.register(self.release_connection) @@ -338,10 +338,6 @@ def getMovie(self, n_frames: int, exposure: float = None, **kwargs) -> List[np.n return data - def isCameraInfoAvailable(self) -> bool: - """Check if the camera is available.""" - return True - def get_image_dimensions(self) -> (int, int): """Get the binned dimensions reported by the camera.""" binning = self.get_binning() @@ -356,11 +352,11 @@ def get_camera_dimensions(self) -> (int, int): """Get the dimensions reported by the camera.""" return self.dimensions - def getName(self) -> str: + def get_name(self) -> str: """Get the name reported by the camera.""" return self.name - def establishConnection(self) -> None: + def establish_connection(self) -> None: """Establish connection to command port of the merlin software.""" # Create command socket self.s_cmd = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @@ -389,7 +385,7 @@ def establishConnection(self) -> None: for key, value in self.detector_config.items(): self.merlin_set(key, value) - def establishDataConnection(self) -> None: + def establish_data_connection(self) -> None: """Establish connection to the dataport of the merlin software.""" # Create command socket s_data = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @@ -413,7 +409,7 @@ def release_connection(self) -> None: self.s_data.close() - name = self.getName() + name = self.get_name() msg = f"Connection to camera '{name}' released" logger.info(msg) diff --git a/src/instamatic/camera/camera_serval.py b/src/instamatic/camera/camera_serval.py index a0f9c212..1563c7f4 100644 --- a/src/instamatic/camera/camera_serval.py +++ b/src/instamatic/camera/camera_serval.py @@ -26,9 +26,9 @@ def __init__(self, name='serval'): self.load_defaults() - self.establishConnection() + self.establish_connection() - msg = f'Camera {self.getName()} initialized' + msg = f'Camera {self.get_name()} initialized' logger.info(msg) atexit.register(self.release_connection) @@ -112,11 +112,11 @@ def get_camera_dimensions(self) -> (int, int): """Get the dimensions reported by the camera.""" return self.dimensions - def getName(self) -> str: + def get_name(self) -> str: """Get the name reported by the camera.""" return self.name - def establishConnection(self) -> None: + def establish_connection(self) -> None: """Establish connection to the camera.""" self.conn = ServalCamera() self.conn.connect(self.url) @@ -147,7 +147,7 @@ def establishConnection(self) -> None: def release_connection(self) -> None: """Release the connection to the camera.""" self.conn.measurement_stop() - name = self.getName() + name = self.get_name() msg = f"Connection to camera '{name}' released" logger.info(msg) diff --git a/src/instamatic/camera/camera_simu.py b/src/instamatic/camera/camera_simu.py index a095448c..e1ff5e52 100644 --- a/src/instamatic/camera/camera_simu.py +++ b/src/instamatic/camera/camera_simu.py @@ -19,11 +19,11 @@ def __init__(self, name='simulate'): self.name = name - self.establishConnection() + self.establish_connection() self.load_defaults() - msg = f'Camera {self.getName()} initialized' + msg = f'Camera {self.get_name()} initialized' logger.info(msg) atexit.register(self.release_connection) @@ -96,7 +96,7 @@ def acquire_image(self) -> int: """For TVIPS compatibility.""" return 1 - def isCameraInfoAvailable(self) -> bool: + def is_camera_info_available(self) -> bool: """Check if the camera is available.""" return True @@ -114,11 +114,11 @@ def get_camera_dimensions(self) -> (int, int): """Get the dimensions reported by the camera.""" return self.dimensions - def getName(self) -> str: + def get_name(self) -> str: """Get the name reported by the camera.""" return self.name - def establishConnection(self) -> None: + def establish_connection(self) -> None: """Establish connection to the camera.""" res = 1 if res != 1: @@ -126,7 +126,7 @@ def establishConnection(self) -> None: def release_connection(self) -> None: """Release the connection to the camera.""" - name = self.getName() + name = self.get_name() msg = f"Connection to camera '{name}' released" logger.info(msg) diff --git a/src/instamatic/camera/camera_timepix.py b/src/instamatic/camera/camera_timepix.py index b41fe502..dfbcccca 100644 --- a/src/instamatic/camera/camera_timepix.py +++ b/src/instamatic/camera/camera_timepix.py @@ -73,7 +73,7 @@ def __init__(self, name='pytimepix'): atexit.register(self.disconnect) self.is_connected = None - self.name = self.getName() + self.name = self.get_name() self.load_defaults() def acquire_lock(self): @@ -290,7 +290,7 @@ def acquireData(self, exposure=0.001): def get_image(self, exposure): return self.acquireData(exposure=exposure) - def getName(self): + def get_name(self): return 'timepix' def get_camera_dimensions(self) -> (int, int): @@ -332,7 +332,7 @@ def initialize(config, name='pytimepix'): cam.readPixelsCfg(pixelsCfg) cam.readRealDacs(realDacs) - print(f'Camera {cam.getName()} initialized (resolution: {cam.get_camera_dimensions()})') + print(f'Camera {cam.get_name()} initialized (resolution: {cam.get_camera_dimensions()})') return cam From a66848c0ccb6da50314ecb5d2fe620aad56413c6 Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 10:08:40 +0200 Subject: [PATCH 15/19] Snakecase getMovie --- docs/merlin.md | 2 +- src/instamatic/TEMController/TEMController.py | 2 +- src/instamatic/camera/camera_merlin.py | 6 +++--- src/instamatic/camera/camera_serval.py | 2 +- src/instamatic/camera/camera_simu.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/merlin.md b/docs/merlin.md index 362ad49f..bd5dd15e 100644 --- a/docs/merlin.md +++ b/docs/merlin.md @@ -4,7 +4,7 @@ The [MerlinEM detector](https://quantumdetectors.com/products/merlinem/) by Quan Instamatic communicates with the Merlin control software via TCP/IP connection. This means that there is a fast connection with little overhead when collecting data. -In continous read/write mode, instamatic can achieve gapless data acquisition `MerlinCamera.getMovie()`. When continuously collecting single images using `MerlinCamera.get_image()`, there is a ~3 ms overhead per frame. +In continous read/write mode, instamatic can achieve gapless data acquisition `MerlinCamera.get_movie()`. When continuously collecting single images using `MerlinCamera.get_image()`, there is a ~3 ms overhead per frame. ## Setup diff --git a/src/instamatic/TEMController/TEMController.py b/src/instamatic/TEMController/TEMController.py index 1de98d3c..94febe95 100644 --- a/src/instamatic/TEMController/TEMController.py +++ b/src/instamatic/TEMController/TEMController.py @@ -698,7 +698,7 @@ def get_movie(self, if self.autoblank: self.beam.unblank() - stack = self.cam.getMovie(n_frames=n_frames, exposure=exposure, binsize=binsize) + stack = self.cam.get_movie(n_frames=n_frames, exposure=exposure, binsize=binsize) if self.autoblank: self.beam.blank() diff --git a/src/instamatic/camera/camera_merlin.py b/src/instamatic/camera/camera_merlin.py index 11da1d1a..89a56b81 100644 --- a/src/instamatic/camera/camera_merlin.py +++ b/src/instamatic/camera/camera_merlin.py @@ -19,7 +19,7 @@ frame = cam.get_image(exposure=0.1) # acquire multiple frames with gapless acquisition -frames = cam.getMovie(n_frames=10, exposure=0.1) +frames = cam.get_movie(n_frames=10, exposure=0.1) ``` """ @@ -271,7 +271,7 @@ def get_image(self, exposure: float = None, **kwargs) -> np.ndarray: return data - def getMovie(self, n_frames: int, exposure: float = None, **kwargs) -> List[np.ndarray]: + def get_movie(self, n_frames: int, exposure: float = None, **kwargs) -> List[np.ndarray]: """Gapless movie acquisition routine. If the exposure is not given, the default value is read from the config file. @@ -422,7 +422,7 @@ def test_movie(cam): t0 = time.perf_counter() - frames = cam.getMovie(n_frames, exposure=exposure) + frames = cam.get_movie(n_frames, exposure=exposure) t1 = time.perf_counter() diff --git a/src/instamatic/camera/camera_serval.py b/src/instamatic/camera/camera_serval.py index 1563c7f4..75fb9d5b 100644 --- a/src/instamatic/camera/camera_serval.py +++ b/src/instamatic/camera/camera_serval.py @@ -72,7 +72,7 @@ def get_image(self, exposure=None, binsize=None, **kwargs) -> np.ndarray: arr = np.array(img) return arr - def getMovie(self, n_frames, exposure=None, binsize=None, **kwargs): + def get_movie(self, n_frames, exposure=None, binsize=None, **kwargs): """Movie acquisition routine. If the exposure and binsize are not given, the default values are read from the config file. diff --git a/src/instamatic/camera/camera_simu.py b/src/instamatic/camera/camera_simu.py index e1ff5e52..eada7bc9 100644 --- a/src/instamatic/camera/camera_simu.py +++ b/src/instamatic/camera/camera_simu.py @@ -73,7 +73,7 @@ def get_image(self, exposure=None, binsize=None, **kwargs) -> np.ndarray: return arr - def getMovie(self, n_frames, *, exposure: float = None, binsize: int = None, **kwargs): + def get_movie(self, n_frames, *, exposure: float = None, binsize: int = None, **kwargs): """"Movie acquisition routine. If the exposure and binsize are not given, the default values are read from the config file. From 6aca8af2ae6fc1a16f54490b5a1f36eafe640272 Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 10:15:21 +0200 Subject: [PATCH 16/19] Snakecase timepix --- src/instamatic/camera/camera_timepix.py | 68 ++++++++++++------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/instamatic/camera/camera_timepix.py b/src/instamatic/camera/camera_timepix.py index dfbcccca..ae01ef52 100644 --- a/src/instamatic/camera/camera_timepix.py +++ b/src/instamatic/camera/camera_timepix.py @@ -23,7 +23,7 @@ class LockingError(RuntimeError): pass -def arrangeData(raw, out=None): +def arrange_data(raw, out=None): """10000 loops, best of 3: 81.3 s per loop.""" s = 256 * 256 q1 = raw[0:s].reshape(256, 256) @@ -41,7 +41,7 @@ def arrangeData(raw, out=None): return out -def correctCross(raw, factor=2.15): +def correct_cross(raw, factor=2.15): """100000 loops, best of 3: 18 us per loop.""" raw[255:258] = raw[255] / factor raw[:, 255:258] = raw[:, 255:256] / factor @@ -118,10 +118,10 @@ def disconnect(self): print('Camera disconnect failed...') return ret - def getFrameSize(self): + def get_frame_size(self): return self.lib.EMCameraObj_getFrameSize(self.obj) - def readRealDacs(self, filename): + def read_real_dacs(self, filename): """std::string filename.""" if not os.path.exists(filename): raise OSError(f'Cannot find `RealDacs` file: {filename}') @@ -137,7 +137,7 @@ def readRealDacs(self, filename): self.disconnect() sys.exit() - def readHwDacs(self, filename): + def read_hw_dacs(self, filename): """std::string filename.""" if not os.path.exists(filename): raise OSError(f'Cannot find `HwDacs` file: {filename}') @@ -153,7 +153,7 @@ def readHwDacs(self, filename): self.disconnect() sys.exit() - def readPixelsCfg(self, filename): + def read_pixels_cfg(self, filename): """std::string filename.""" 'int mode = TPX_MODE_DONT_SET -> set in header file' if not os.path.exists(filename): @@ -170,7 +170,7 @@ def readPixelsCfg(self, filename): self.disconnect() sys.exit() - def processRealDac(self, chipnr=None, index=None, key=None, value=None): + def process_real_dac(self, chipnr=None, index=None, key=None, value=None): """int *chipnr.""" 'int *index' 'std::string *key' @@ -183,7 +183,7 @@ def processRealDac(self, chipnr=None, index=None, key=None, value=None): self.lib.EMCameraObj_processRealDac(self.obj, byref(chipnr), byref(index), key, value) - def processHwDac(self, key, value): + def process_hw_dac(self, key, value): """std::string *key.""" 'std::string *value' @@ -191,15 +191,15 @@ def processHwDac(self, key, value): value = create_unicode_buffer(20) self.lib.EMCameraObj_processHwDac(self.obj, byref(key), byref(value)) - def startAcquisition(self): - """Equivalent to openShutteR?""" + def start_acquisition(self): + """Equivalent to openShutter?""" self.lib.EMCameraObj_startAcquisition(self.obj) - def stopAcquisition(self): - """Equivalent to closeShutter?""" + def stop_acquisition(self): + """Equivalent to close_shutter?""" self.lib.EMCameraObj_stopAcquisition(self.obj) - def openShutter(self): + def open_shutter(self): """Opens the Relaxd shutter under software control. Note that opening and closing the shutter under software control @@ -209,11 +209,11 @@ def openShutter(self): """ self.lib.EMCameraObj_openShutter(self.obj) - def closeShutter(self): + def close_shutter(self): """Closes shutter under software control.""" self.lib.EMCameraObj_closeShutter(self.obj) - def readMatrix(self, arr=None, sz=512 * 512): + def read_matrix(self, arr=None, sz=512 * 512): """Reads a frame from all connected devices, decodes the data and stores the pixel counts in array data. @@ -231,7 +231,7 @@ def readMatrix(self, arr=None, sz=512 * 512): return arr - def enableTimer(self, enable, us): + def enable_timer(self, enable, us): """Disables (enable is false) or enables the timer and sets the timer time-out to us microseconds. Note that the timer resolution is 10 us. After the Relaxd shutter opens (either explicitly by software or by an @@ -245,50 +245,50 @@ def enableTimer(self, enable, us): self.lib.EMCameraObj_enableTimer(self.obj, enable, us) - def resetMatrix(self): + def reset_matrix(self): self.lib.EMCameraObj_resetMatrix(self.obj) - def timerExpired(self): + def timer_expired(self): return self.lib.EMCameraObj_timerExpired(self.obj) - def setAcqPars(self, pars): + def set_acq_pars(self, pars): """AcqParams *pars.""" raise NotImplementedError pars = AcqParams self.lib.EMCameraObj_setAcqPars(self.obj, byref(pars)) - def isBusy(self, busy): + def is_busy(self, busy): """bool *busy.""" busy = c_bool(busy) self.lib.EMCameraObj_isBusy(self.obj, byref(busy)) - def acquireData(self, exposure=0.001): + def acquire_data(self, exposure=0.001): microseconds = int(exposure * 1e6) # seconds to microseconds - self.enableTimer(True, microseconds) + self.enable_timer(True, microseconds) - self.openShutter() + self.open_shutter() # sleep here to avoid burning cycles # only sleep if exposure is longer than Windows timer resolution, i.e. 1 ms if exposure > 0.001: time.sleep(exposure - 0.001) - while not self.timerExpired(): + while not self.timer_expired(): pass - # self.closeShutter() + # self.close_shutter() - arr = self.readMatrix() + arr = self.read_matrix() - out = arrangeData(arr) - correctCross(out, factor=self.correction_ratio) + out = arrange_data(arr) + correct_cross(out, factor=self.correction_ratio) out = np.rot90(out, k=3) return out def get_image(self, exposure): - return self.acquireData(exposure=exposure) + return self.acquire_data(exposure=exposure) def get_name(self): return 'timepix' @@ -328,9 +328,9 @@ def initialize(config, name='pytimepix'): cam.init() - cam.readHwDacs(hwDacs) - cam.readPixelsCfg(pixelsCfg) - cam.readRealDacs(realDacs) + cam.read_hw_dacs(hwDacs) + cam.read_pixels_cfg(pixelsCfg) + cam.read_real_dacs(realDacs) print(f'Camera {cam.get_name()} initialized (resolution: {cam.get_camera_dimensions()})') @@ -359,11 +359,11 @@ def initialize(config, name='pytimepix'): t = 0.01 n = 100 - arr = cam.acquireData(t) + arr = cam.acquire_data(t) print(f'[ py hardware timer] -> shape: {arr.shape}') t0 = time.perf_counter() for x in range(n): - cam.acquireData(t) + cam.acquire_data(t) dt = time.perf_counter() - t0 print(f'Total time: {dt:.1f} s, acquisition time: {1000*(dt/n):.2f} ms, overhead: {1000*(dt/n - t):.2f} ms') From 563da15c97b3b2768bf17f699b570e43e85c3261 Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 09:31:12 +0200 Subject: [PATCH 17/19] Bump version 1.10.0 -> 2.0.0 --- .bumpversion.cfg | 10 +++++----- CITATION.cff | 2 +- pyproject.toml | 2 +- src/instamatic/__init__.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index d704a0dc..56f5d072 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,16 +1,16 @@ [bumpversion] -current_version = 1.10.0 +current_version = 2.0.0 [comment] comment = The contents of this file cannot be merged with that of setup.cfg until https://github.com/c4urself/bump2version/issues/185 is resolved -[bumpversion:file:instamatic/__init__.py] +[bumpversion:file:src/instamatic/__init__.py] search = __version__ = '{current_version}' replace = __version__ = '{new_version}' -[bumpversion:file:setup.cfg] -search = version = {current_version} -replace = version = {new_version} +[bumpversion:file:pyproject.toml] +search = version = "{current_version}" +replace = version = "{new_version}" [bumpversion:file:CITATION.cff] search = version: "{current_version}" diff --git a/CITATION.cff b/CITATION.cff index 02567761..10d6fc42 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -27,5 +27,5 @@ doi: "10.5281/zenodo.1090388" license: "BSD-3-Clause" message: "If you use this software, please cite it using these metadata." title: Instamatic -version: "1.10.0" +version: "2.0.0" ... diff --git a/pyproject.toml b/pyproject.toml index 2f846fa2..86594571 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" # https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ [project] name = "instamatic" -version = "1.10.0" +version = "2.0.0" description = "Python program for automated electron diffraction data collection" readme = "README.md" requires-python = ">=3.7" diff --git a/src/instamatic/__init__.py b/src/instamatic/__init__.py index 841eb321..ca6faba7 100644 --- a/src/instamatic/__init__.py +++ b/src/instamatic/__init__.py @@ -9,7 +9,7 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # """ -__version__ = '1.10.0' +__version__ = '2.0.0' __title__ = 'instamatic' __long_title__ = f'{__title__} v{__version__}' __author__ = 'Stef Smeets' From 959eb18e2bb8fe9c323aabc7064a60d5e8ace198 Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 10:54:00 +0200 Subject: [PATCH 18/19] Raise error for movie acquisition over a socket --- src/instamatic/camera/camera_client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/instamatic/camera/camera_client.py b/src/instamatic/camera/camera_client.py index a327b1f8..dbe39570 100644 --- a/src/instamatic/camera/camera_client.py +++ b/src/instamatic/camera/camera_client.py @@ -120,6 +120,10 @@ def _eval_dct(self, dct): self.s.send(dumper(dct)) acquiring_image = dct['attr_name'] == 'get_image' + acquiring_movie = dct['attr_name'] == 'get_movie' + + if acquiring_movie: + raise NotImplementedError('Acquiring movies over a socket is not supported.') if acquiring_image and not self.use_shared_memory: response = self.s.recv(self._imagebufsize) From ad001dfeb783eb8434486fd43d6f70eb17380a66 Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Fri, 23 Jun 2023 11:04:35 +0200 Subject: [PATCH 19/19] Update github action --- .github/workflows/publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 70d8f9c5..a421b953 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,16 +12,16 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: '3.11' - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine - python setup.py sdist bdist_wheel + pip install -U build setuptools wheel + python -m build --no-isolation - name: Publish package - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_TOKEN }}