Getting Started
Installation
Please see README.md
Desktop Shortcut
To create a desktop shortcut for FibsemUI, simply run the shortcut.py file.
System Configuration
The system configuration is defined by a system.yaml file. This defines various system settings, including connection details, beam, imaging, and stage settings.
You will need to change the ip_address to connect to your microscope.
The default file can be found in fibsem/config/system.yaml. When you call utils.setup_session() with no arguments, the default file is used. You can either edit the default file, or provide the config_path to your own system.yaml file in setup_session.
WIP: update for v2
# system
system:
ip_address: 10.0.0.1
application_file: autolamella
manufacturer: Thermo # Thermo or Tescan
# beams
ion:
voltage: 30000
current: 20.e-12
plasma_gas: "Argon" # proper case, e.g. Argon, Oxygen
eucentric_height: 16.5e-3
detector_type: ETD
detector_mode: SecondaryElectrons
electron:
voltage: 2000
current: 1.0e-12
eucentric_height: 4.0e-3
detector_type: ETD
detector_mode: SecondaryElectrons
# stage
stage:
rotation_flat_to_electron: 50 # degrees
rotation_flat_to_ion: 230 # degrees
tilt_flat_to_electron: 35 # degrees (pre-tilt)
tilt_flat_to_ion: 52 # degrees
pre_tilt: 35
needle_stage_height_limit: 3.7e-3
# user config settings
user:
imaging_current: 20.e-12
milling_current: 2.e-9
resolution: "1536x1024"
hfw: 150.e-6
beam_type: "Electron"
autocontrast: True
dwell_time: 1.e-6
save: False
gamma: # gamma correction parameters
enabled: True
min_gamma: 0.15
max_gamma: 1.8
scale_factor: 0.01
threshold: 46 # px
Note: setup_session will not automatically switch to these settings. To do so, you need to call validation.validate_initial_microscope_state.
Example
Once you have changed your system.yaml file, you should be able to run example/example.py to take images with both beams, and plot.
from fibsem import utils, acquire
import matplotlib.pyplot as plt
def main():
# connect to microscope
microscope, settings = utils.setup_session()
# take image with both beams
eb_image, ib_image = acquire.take_reference_images(microscope, settings.image)
# show images
fig, ax = plt.subplots(1, 2, figsize=(7, 5))
ax[0].imshow(eb_image.data, cmap="gray")
ax[1].imshow(ib_image.data, cmap="gray")
plt.show()
if __name__ == "__main__":
main()
The Basics
Microscope Connection
The microscope is a client connection to the Microscope Server. At the moment, only ThermoFisher AutoScript Client is supported.
MicroscopeSettings
MicroscopeSettings is a large structure containing the settings for the different microscope systems.
A data class representing the settings for a microscope system.
Attributes:
Name | Type | Description |
---|---|---|
system |
SystemSettings
|
An instance of the |
image |
ImageSettings
|
An instance of the |
protocol |
dict
|
A dictionary representing the protocol settings. Defaults to None. |
milling |
FibsemMillingSettings
|
An instance of the |
Methods:
Name | Description |
---|---|
__to_dict__ |
Returns a dictionary representation of the |
__from_dict__ |
dict, protocol: dict = None) -> "MicroscopeSettings": Returns an instance of the |
Source code in fibsem/structures.py
1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 |
|
It is populated from your configuration in system.yaml. Most functions take a combination of the microscope client, and settings as arguments.
Taking an Image
The most basic use case for the package is taking an image. Imaging functions are contained in fibsem.acquire, and imaging conditions are controlled by modifying the ImageSettings struct.
Apply the given image settings and acquire a new image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
microscope |
FibsemMicroscope
|
The FibsemMicroscope instance used to acquire the image. |
required |
settings |
ImageSettings
|
The image settings used to acquire the image. |
required |
Returns:
Name | Type | Description |
---|---|---|
FibsemImage |
FibsemImage
|
The acquired image. |
Source code in fibsem/acquire.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
|
A data class representing the settings for an image acquisition.
Attributes:
Name | Type | Description |
---|---|---|
resolution |
list of int
|
The resolution of the acquired image in pixels, [x, y]. |
dwell_time |
float
|
The time spent per pixel during image acquisition, in seconds. |
hfw |
float
|
The horizontal field width of the acquired image, in microns. |
autocontrast |
bool
|
Whether or not to apply automatic contrast enhancement to the acquired image. |
beam_type |
BeamType
|
The type of beam to use for image acquisition. |
save |
bool
|
Whether or not to save the acquired image to disk. |
label |
str
|
The label to use when saving the acquired image. |
gamma_enabled |
bool
|
Whether or not to apply gamma correction to the acquired image. |
save_path |
Path
|
The path to the directory where the acquired image should be saved. |
reduced_area |
FibsemRectangle
|
The rectangular region of interest within the acquired image, if any. |
Methods:
Name | Description |
---|---|
__from_dict__ |
dict) -> ImageSettings: Converts a dictionary of image settings to an ImageSettings object. |
__to_dict__ |
Converts the ImageSettings object to a dictionary of image settings. |
Source code in fibsem/structures.py
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 |
|
fromFibsemImage(image)
staticmethod
Returns the image settings for a FibsemImage object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image |
FibsemImage
|
The FibsemImage object to get the image settings from. |
required |
Returns:
Name | Type | Description |
---|---|---|
ImageSettings |
ImageSettings
|
The image settings for the given FibsemImage object. |
Source code in fibsem/structures.py
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 |
|
ImageSettings is part of the MicroscopeSettings, and can be accessed by settings.image. For example, to change the hfw of the image and take an image (snippet):
# change hfw to 400e-6
settings.image.hfw = 400e-6
# take image
image = acquire.new_image(microscope, settings.image)
Movement
...
Milling
...