Skip to content

Commit 07565d9

Browse files
committed
Merge branch 'main' into FastADT_squashed
# Conflicts: # src/instamatic/_collections.py # src/instamatic/experiments/fast_adt/experiment.py
2 parents 71438f6 + 63155a2 commit 07565d9

File tree

3 files changed

+20
-44
lines changed

3 files changed

+20
-44
lines changed

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ requires-python = ">=3.9"
1212
authors = [
1313
{name = "Stef Smeets", email = "s.smeets@esciencecenter.nl"},
1414
]
15+
maintainers = [
16+
{name = "Daniel Mariusz Tchoń", email = "tchon@fzu.cz"}
17+
]
1518
keywords = [
1619
"electron-crystallography",
1720
"electron-microscopy",

readme.md

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -73,37 +73,7 @@ Alternatively, some of the methods implemented in `Instamatic` are described in:
7373

7474
- S. Smeets, X. Zou, and W. Wan, [Serial electron crystallography for structure determination and phase analysis of nanocrystalline materials](http://dx.doi.org/10.1107/S1600576718009500), J. Appl. Cryst. (2018). 51, 1262–1273
7575

76-
## Source Code Structure
77-
78-
* **`demos/`** - Jupyter demo notebooks
79-
* **`docs/`** - Documentation
80-
* **`src/`** - Source code for instamatic
81-
* **`src/instamatic/`**
82-
* **`calibrate/`** - Tools for calibration
83-
* **`camera/`** - Camera interaction code
84-
* **`config/`** - Configuration management
85-
* **`experiments/`** - Specific data collection routines
86-
* **`formats/`** - Image formats and other IO
87-
* **`gui/`** - GUI code
88-
* **`microscope/`** - Microscope interaction code
89-
* **`neural_network/`** - Crystal quality prediction
90-
* **`processing/`** - Data processing tools
91-
* **`server/`** - Manages interprocess/network communication
92-
* **`utils/`** - Helpful utilities
93-
* **`acquire_at_items.py`** - Stage movement/data acquisition engine
94-
* **`admin.py`** - Check for administrator
95-
* **`banner.py`** - Appropriately annoying thank you message
96-
* **`browser.py`** - Montage browsing class
97-
* **`controller.py`** - Main instrument interaction code
98-
* **`exceptions.py`** - Internal exceptions
99-
* **`goniotool.py`** - Goniotool (JEOL) interaction code
100-
* **`gridmontage.py`** - Grid montage data collection code
101-
* **`image_utils.py`** - Image transformation routines
102-
* **`imreg.py`** - Image registration (cross correlation)
103-
* **`io.py`** - Some io-related scripts
104-
* **`main.py`** - Main entry point
105-
* **`montage.py`** - Image stitching
106-
* **`navigation.py`** - Optimize navigation paths
107-
* **`tools.py`** - Collection of functions used throughout the code
108-
* **`scripts/`** - Helpful scripts
109-
* **`pyproject.toml`** - Dependency/build system declaration
76+
## Maintenance
77+
78+
- 2025-now: [@Baharis](https://github.com/Baharis)
79+
- 2015-2025: [@stefsmeets](https://github.com/stefsmeets)

src/instamatic/experiments/fast_adt/experiment.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -385,26 +385,20 @@ def enqueue_still_steps(self, run: Run) -> None:
385385
self.steps_queue.put(step)
386386
self.steps_queue.put(None)
387387

388-
def collect_continuous(self, run) -> None:
388+
def collect_continuous(self, run: Run) -> None:
389389
"""Collect a series of scans at angles/exposure specified in `run`"""
390390
self.msg('Collecting scans from {} to {} degree'.format(*run.scope))
391391
images, metas = [], []
392392
if run.has_beam_delta_information:
393393
run.calculate_beamshifts(self.ctrl, self.beamshift)
394-
395-
# this part correctly finds the closest possible speed settings for expt
396-
detector_dead_time = self.get_dead_time(run.exposure)
397-
time_for_one_frame = run.exposure + detector_dead_time
398-
rot_calib = self.get_stage_rotation()
399-
rot_plan = rot_calib.plan_rotation(time_for_one_frame / run.osc_angle)
400-
run.exposure = abs(rot_plan.pace * run.osc_angle) - detector_dead_time
394+
rot_speed, run.exposure = self.determine_rotation_speed_and_exposure(run)
401395

402396
self.ctrl.stage.a = float(run.table.loc[0, 'alpha'])
403-
with self.ctrl.stage.rotation_speed(speed=rot_plan.speed):
397+
with self.ctrl.stage.rotation_speed(speed=rot_speed):
404398
with self.ctrl.beam.unblanked(delay=0.2):
405399
movie = self.ctrl.get_movie(n_frames=len(run.table) - 1, exposure=run.exposure)
406400
a = float(run.table.iloc[-1].loc['alpha'])
407-
self.ctrl.stage.set_with_speed(a=a, speed=rot_plan.speed, wait=False)
401+
self.ctrl.stage.set_with_speed(a=a, speed=rot_speed, wait=False)
408402
for step, (image, header) in zip(run.steps, movie):
409403
if run.has_beam_delta_information:
410404
self.ctrl.beamshift.set(step.beamshift_x, step.beamshift_y)
@@ -415,6 +409,15 @@ def collect_continuous(self, run) -> None:
415409
self.run.table['meta'] = metas
416410
self.msg('Collected scans from {} to {} degree'.format(*run.scope))
417411

412+
def determine_rotation_speed_and_exposure(self, run: Run) -> tuple[float, float]:
413+
"""Closest possible speed setting & exposure considering dead time."""
414+
detector_dead_time = self.get_dead_time(run.exposure)
415+
time_for_one_frame = run.exposure + detector_dead_time
416+
rot_calib = self.get_stage_rotation()
417+
rot_plan = rot_calib.plan_rotation(time_for_one_frame / run.osc_angle)
418+
exposure = abs(rot_plan.pace * run.osc_angle) - detector_dead_time
419+
return rot_plan.speed, exposure
420+
418421
def finalize(self) -> None:
419422
self.msg(f'Saving experiment in: {self.path}')
420423
rotation_axis = config.camera.camera_rotation_vs_stage_xy

0 commit comments

Comments
 (0)