pyfast_adt.main.adaptor.camera.adaptor_merlin
Attributes
Classes
Camera interface for the Quantum Detectors Merlin camera. |
Functions
|
Generate TCP command bytes for Merlin software. |
|
|
|
|
Module Contents
- pyfast_adt.main.adaptor.camera.adaptor_merlin.MPX_CMD(type_cmd: str = 'GET', cmd: str = 'DETECTORSTATUS') bytes
Generate TCP command bytes for Merlin software.
Default value ‘GET,DETECTORSTATUS’ probes for the current status of the detector.
- Parameters:
type_cmd (str, optional) – Type of the command
cmd (str, optional) – Command to execute
- Returns:
Command code in bytes format
- Return type:
bytes
- class pyfast_adt.main.adaptor.camera.adaptor_merlin.Cam_merlin(instance_gui=None)
Bases:
pyfast_adt.main.adaptor.camera.adaptor_cam.Cam_baseCamera interface for the Quantum Detectors Merlin camera.
- START_SIZE = 14
- MAX_NUMFRAMESTOACQUIRE = 42949672950
- name = None
- _state
- _soft_trigger_mode = False
- _soft_trigger_exposure = None
- default_exposure = 0.5
- detector_config
- s_data = None
- s_cmd = None
- exposure = 100
- x = None
- y = None
- processing = 'Unprocessed'
- delay = None
- binning = 1
- default_binsize = 1
- buffer_size = None
- stop_signal = None
- buffer = None
- instance_gui = None
- table = None
- timings = []
- _frame_number = 0
- receive_data(continuous=False, *, nbytes: int) bytearray
Safely receive from the socket until n_bytes of data are received.
- merlin_set(key: str, value: Any)
Set state on Merlin parameter through command socket.
- merlin_get(key: str) str
Get state of Merlin parameter through command socket.
- merlin_cmd(key: str)
Send Merlin command through command socket.
- setup_soft_trigger(exposure=None)
Set up for repeated acquisition using soft trigger, and start acquisition. exposure in ms
- teardown_soft_trigger()
Stop soft trigger acquisition. i.e. continuous acquisition.
- get_image(exposure=None, **kwargs) numpy.ndarray
Image acquisition routine. If the exposure is not given, the default value is read from the config file. the exposure in ms.
- get_movie(n_frames: int, exposure: float = None, **kwargs)
Gapless movie acquisition routine. If the exposure is not given, the default value is read from the config file.
- get_image_dimensions()
Get the binned dimensions reported by the camera.
- get_camera_dimensions()
Get the dimensions reported by the camera.
- get_name() str
Get the name reported by the camera.
- connect()
‘ connection with the device
- establish_connection() None
Establish connection to command port of the merlin software.
- establish_data_connection() None
Establish connection to the dataport of the merlin software.
- release_connection() None
Release the connection to the camera.
- set_exposure(exposure_time: int)
‘ set the exposure time in ms for the camera
- get_exposure()
‘ get the exposure time in ms for the camera
- start_liveview(delay: float)
‘ start the live view of the camera
- stop_liveview()
‘ stop the live view of the camera
- set_binning(binning: int)
‘ set the binning of the camera, common parameters are 1, 2, 4, 8
- get_binning()
‘ get the binning of the camera
- acquire_image(exposure_time: int, binning: int, processing='Unprocessed')
Acquire image through its adaptor and return it, exposure in ms and binning is usually 1
- acquire_image_and_show(exposure_time: int, binning: int, processing='Unprocessed')
Acquire image through its adaptor and return it, exposure in ms and binning is usually 1
- rotate_img(img, times=None, flip_h=None, flip_v=None)
- set_processing(processing: str)
‘ set the processing of the camera, processing = “Unprocessed” is the only available for this camera
- get_processing()
‘ get the processing type of the camera
- acquire_series_images(exposure_time: int, binning=1, processing='unprocessed', buffers=None, stop_signal=None, display=False)
Image acquisition routine using multiple softtriggers. the exposure in ms. you need to pass the buffers where to save the images and a stop signal to say that the acquisition is finished.
the acquisition loop can finish in 3 ways: self.stopper = True, usually in case of multithreading, someone else can set it to True, stop_signal.is_alive() == False, the thread associated with stop_signal is no more alive, the buffers are full the acquisition is finished.
- prepare_acquisition_cRED_data(camera: str, binning: int, exposure: int, buffer_size, FPS_devider=1)
this need to be modified usign the new acquire_series_images function
- acquisition_cRED_data(stage_thread=None, timer=None, event=None, stop_event=None)
Acquire images into the buffer up to the thread is alive, usually the stage thread is passed for cRED experiments
- save_cRED_data(savingpath)
- correctCross(raw, factor=2)
correct the cross of the collected image from (512,512) to (514,514). the intensity from the neighboring pixels is divided by the factor value and assigned to the “cross” pixels. return the corrected image as a np.array of shape (514,514) the intensity of the reflections inside the cross are splitted in 2 consequent pixels
- get_camera_characteristic()
- load_calibration_table()
- is_cam_streaming()
True is the camera have a live mode where you can retrieve the images from the memory like the xf416r, otherwise False like the timepix1
- is_cam_bottom_mounted()
True if the camera is mounted on the bottom of the microscope, otherwise False
- pyfast_adt.main.adaptor.camera.adaptor_merlin.test_movie(cam)
- pyfast_adt.main.adaptor.camera.adaptor_merlin.test_single_frame(cam)
- pyfast_adt.main.adaptor.camera.adaptor_merlin.test_plot_single_image(cam)
- pyfast_adt.main.adaptor.camera.adaptor_merlin.cam