PyJEM.detectorext.function module¶
-
class
PyJEM.detectorext.function.
Detector
(det)¶ Bases:
object
-
get_detectorsetting
() → dict¶ Obtaining setting information of selected detector.
- Returns
get the selected detector’s info.
- Return type
dict
Example
>>> detector.Detector(detector name).get_detectorsetting() { "ExposureTimeValue":100, "GainIndex":100, ... }
-
get_linedata
(start: int, end: int) → bytes¶ To get the image data of the specified line.
- Parameters
start (int) – line number
end (int) – line number
- Returns
One pixel is two bytes. A byte order is little endian.
- Return type
bytes
Note
This data in the order corresponding to “LUTScanSetting.LookUpTable”. “start” value is line number of first data. “end” value is line number of last data.
Note
only available for MDP.
-
get_selectdata
(start: int, end: int) → bytes¶ Get the image data of the specified pixels. If “scanMode” is not “4” (LUTScan), this API is the same as get_linedata module.
- Parameters
start (int) – index (byte position.)
end (int) – index (byte position.)
- Returns
One pixel is two bytes. A byte order is little endian.
- Return type
bytes
Note
This data in the order corresponding to “LUTScanSetting.LookUpTable”. “start” value is line number of first data. “end” value is line number of last data.
Note
only available for MDP.
-
livesnapshot
(ext: str, save=False, filename=None, show=False)¶ Take an image with the specified extension. Obtaining images faster than “snapshot”.
- Parameters
extention (str) – “jpg”, “bmp”, “tiff”
save (bool) – ‘True’ is save capture file.
filename (str) – Name of file to save. It is possible to include an absolute path. Only available when ‘save’ is True.
show (bool) – show the Image file.
- Returns
if enter argument is only “extention”, return value is image data stream (bytes). else return value is saved file name.
File stream saved with the selected extension
- Return type
bytes or str
-
livestart
() → dict¶ Start live.
- Returns
Execution result
- Return type
dict
Example
>>> det=detector.Detector(detector name) >>> det.livestart() {"status":"OK"}
-
livestop
() → dict¶ Stop live.
- Returns
Execution result
-
set_areamode_imagingarea
(Width: int, Height: int, X=None, Y=None) → dict¶ Set the beam position when ScanMode is “Area”. Sets which part of the scanning range set by ImagingArea is scanned. The top left vertex is (0, 0). If no value is entered for the argument, the value is not changed.
- Parameters
X (int) – 0-4096
Y (int) – 0-4096
Width (int) – 0-4096
Height (int) – 0-4096
- Returns
The value set to TEM.
- Return type
dict
-
set_detectorsetting
(body: dict) → dict¶ Wild card method.
- Parameters
body (dict) – “key” is function name you want to use. “value” is to change value.
- Returns
The value set to TEM.
- Return type
dict
Example
>>> body = {"ExposureTimeValue":100,"GainIndex":8000,"OffsetIndex":8000} >>> detector.Detector(detector name).set_detectorsetting(body)
-
set_exposuretime_index
(value: int) → dict¶ Set the exposure time as index.
- Parameters
value (int) – exposure time index. range is 0-65535
- Returns
The value set to TEM.
- Return type
dict
Example
>>> detector.Detector(detector name).set_exposuretime_index(100) {"ExposureTimeIndex":100}
Note
value(Args)’s range sdepends on TEM model
-
set_exposuretime_value
(value: float) → dict¶ Set the exposure time as usec value.
- Parameters
value (float) – 0.0-1000.0(μsec)
- Returns
The value set to TEM.
Note
value(Args)’s range sdepends on TEM model
-
set_gainindex
(value: int) → dict¶ Set the gain value as index.
- Parameters
value (int) – 0- 4095
- Returns
The value set to TEM.
- Return type
dict
Note
value(Args)’s range sdepends on TEM model
-
set_imaging_area
(Width: int, Height: int, X=None, Y=None) → dict¶ Set the number of pixels of the live image. x and y are the coordinates of the starting pixel of the read image. width and height are the coordinates of the end pixel of the read image. If no value is entered for the argument, the value is not changed.
- Parameters
X (int) – 0-4096
Y (int) – 0-4096
Width (int) – 0-4096
Height (int) – 0-4096
- Returns
The value set to TEM.
- Return type
dict
-
set_offsetindex
(value: int) → dict¶ Set the offset value as index.
- Parameters
value (int) – 0- 4095
- Returns
The value set to TEM.
- Return type
dict
Note
value(Args)’s range sdepends on TEM model
-
set_scanmode
(value: int) → dict¶ Set the scanMode. :param value: 0= Scan, 1= Area, 3= Spot :type value: int
- Returns
The value set to TEM.
- Return type
dict
-
set_scanrotation
(value: float) → dict¶ Set the scanRotation angle as absolute value.
- Parameters
value (float) – 0.0-360.0
- Returns
The value set to TEM.
- Return type
dict
-
set_spotposition
(X: int, Y: int) → dict¶ Set the beam position when ScanMode is “Spot”. Sets which part of the scanning range set by ImagingArea is scanned. The top left vertex is (0, 0). If no value is entered for the argument, the value is not changed.
- Parameters
X (int) – 0-4096
Y (int) – 0-4096
- Returns
The value set to TEM.
- Return type
dict
-
set_syncmode
(value: int) → dict¶ Set the Syncmode.
- Parameters
value (int) – 0= Power, 1= Inside, 4= External
- Returns
The value set to TEM.
- Return type
dict
Note
only available for MDP.
-
snapshot
(ext: str, save=False, filename=None, show=False)¶ Acquire image about the args “extension”. The image is taken with the selected detector and the acquired image array is output or saved.
- Parameters
extention (str) – “jpg”, “bmp”, “tiff”
save (bool) – ‘True’ is save capture file.
filename (str) – Name of file to save. It is possible to include an absolute path. Only available when ‘save’ is True.
show (bool) – show the Image file.
- Returns
if enter argument is only “extention”, return value is image data stream (bytes). else return value is saved file name.
File stream saved with the selected extension. (If there is an input in an argument other than ‘extention’, None is returned.)
-
snapshot_rawdata
() → bytes¶ Raw data of the image acquired by the specified detector. the raw data is returned as a byte array.
- Returns
2 dimensional byte array of acquired image data.
- Return type
dict
-
snapshotframe
(ext: str, save=False, filename=None, show=False)¶ This function is output the acquired image array. this function does not acquire the new image, to return the image array acquired with the snapshotall() function.
- Parameters
extention (str) – “jpg”, “bmp”, “tiff”
save (bool) – ‘True’ is save capture file.
filename (str) – Name of file to save. It is possible to include an absolute path. Only available when ‘save’ is True.
show (bool) – show the Image file.
- Returns
if enter argument is only “extention”, return value is image data stream (bytes). else return value is saved file name (str).
File stream saved with the selected extension
Note
This function does not acquire new image, to return the image array acquired with the snapshotall() function.
-
-
PyJEM.detectorext.function.
assign_channel
(detectorName: str, channel=0) → dict¶ Assign the selected detector to a channel.
- Parameters
detectorName (str) – Detector name
channel (int) – Channel number to assign the detector. (Only multiple channles)
- Returns
Execution result.
- Return type
dict
-
PyJEM.detectorext.function.
get_LUTscansetting
() → dict¶ This is a function to get the LUTScan setting.
- Returns
Output in dict type. The explanation of the output keys is as follows.
- LUTScanSetting (dict):
- LookUpTable (list):
Use only when the shape is “Free”. Set beam positions to scan. The range of these is defined as ±1.0 at the edges of an image size. The center of the image has coordinates (0.0 , 0.0). The edges of it have coordinates ( -1.0 , -1.0 ) and ( 1.0 , 1.0 ). The maximum value for the coordinates is (4,4), and the minimum value is (-4,-4) .
- PixelResolution (int):
Set total number of points to scan on an analytical area. ‘×4’ can be selected when an image size is ‘0.5K’ or less, and ‘×2’ can be selected when it’s size is ‘1K’ or less.
- Shape (int):
Set a kind of shape for LUT scan. LookUpTable will be created by calculating from Shape and Positions except for Free. - Free: Not available. (Use “LookUp Table”) - Spot: Specify the point (X,Y) . - Line: Specify the coordinates of the starting and end points. - Area: A starting point is at the upper-left corner of an analytical area, and an end point is at the bottom-right corner of an analytical area.
- Position (lists):
Free: Not available. (Use “LookUp Table”)
- IgnorePixelCount (int):
Create extra points before an analytical area to ignore a camera trigger.
- BlankingCount (int):
Line: Create points for blanking before an analytical area. Rectangle: Create points for blanking before the beginning of each row in an analytical area. When a shape is Rectangle or Full, a blanking point for one pixel is provided at the end of the horizontal scan. This parameter will be supported in the future.
- Return type
dict
Example
>>> get_LUTscansetting() { "LUTScanSetting":{ "LookUpTable": [ [-1,1], [0.5,0.2], [1,1] ], "PixelResolution" : 0, "Shape":0, "Position":[[-0.29688,-0.82813],[-0.29688,-0.82813],], "PositionCount":[512,512], "IgnorePixelCount": 1, "BlankingCount": 1, }, "LookUpTableMaximum":4.0, "LookUpTableMinimum":-4.0, "LookUpTablePointMaximum":2097151, "LUTOffset":{"X":0.0,"Y":0.0}, }
-
PyJEM.detectorext.function.
get_assignChannels
() → dict¶ Get activate detectors list.
- Returns
activate detectors dict.
- Return type
dict
Example
>>> detector.get_assignChannels() { "0": “BF”, "1": “ADF1”, "2": “ADF2”, "3": “None”, }
-
PyJEM.detectorext.function.
get_attached_detector
() → list¶ Acquisition of detector names currently available in TEMCenter.
- Returns
List of available detector names.
-
PyJEM.detectorext.function.
get_config
() → dict¶ This function returns the package’s settings.
- Returns
service info.
- Return type
dict
Example
>>> detector.get_config() {'name': '---', 'ip': '---', 'port': ---, 'uri': '---'}
-
PyJEM.detectorext.function.
get_lookuptable
()¶ This is a function gets the LookUpTable with binary data.
- Returns
This API will return a byte array (Size(byte) : number of coordinates × 2 (X,Y) × 4 (float) )
- Return type
byte
-
PyJEM.detectorext.function.
set_LUT_offset
(x: float, y: float) → None¶ This API adds an offset to the image position in LUTSacn. It is assumed to be used for drift correction, etc.
- Parameters
x (float) – offset value.
y (float) – offset value.
-
PyJEM.detectorext.function.
set_LUTscansetting
(body)¶ This is a function to set the LUTScan setting.
- Parameters
body (dict) –
The following describes the keys to be set.
- LUTScanSetting (dict):
- LookUpTable (list):
Use only when the shape is “Free”. Set beam positions to scan. The range of these is defined as ±1.0 at the edges of an image size. The center of the image has coordinates (0.0 , 0.0). The edges of it have coordinates ( -1.0 , -1.0 ) and ( 1.0 , 1.0 ). The maximum value for the coordinates is (4,4), and the minimum value is (-4,-4) .
- PixelResolution (int):
Set total number of points to scan on an analytical area. ‘×4’ can be selected when an image size is ‘0.5K’ or less, and ‘×2’ can be selected when it’s size is ‘1K’ or less.
- Shape (int):
Set a kind of shape for LUT scan. LookUpTable will be created by calculating from Shape and Positions except for Free. - Free: Not available. (Use “LookUp Table”) - Spot: Specify the point (X,Y) . - Line: Specify the coordinates of the starting and end points. - Area: A starting point is at the upper-left corner of an analytical area, and an end point is at the bottom-right corner of an analytical area.
- Position (list):
Free: Not available. (Use “LookUp Table”)
- IgnorePixelCount (int):
Create extra points before an analytical area to ignore a camera trigger.
- BlankingCount (int):
Line: Create points for blanking before an analytical area. Rectangle: Create points for blanking before the beginning of each row in an analytical area. When a shape is Rectangle or Full, a blanking point for one pixel is provided at the end of the horizontal scan. This parameter will be supported in the future.
Example
>>> body = { "LUTScanSetting":{ "LookUpTable": "[ [-1,1], [0.5,0.2], [1,1] ]", "PixelResolution" : 0, "Shape":0, "Position":[[-1.0, -1.0],[ 1.0, 1.0],], "IgnorePixelCount": 1, "BlankingCount": 1, }, } >>> set_LUTscansetting(body)
-
PyJEM.detectorext.function.
set_ip
(val: str) → None¶ This function can modify the IP Address which is URI of this package.
- Parameters
val (int) – ip address.
-
PyJEM.detectorext.function.
set_lookuptable
(body)¶ This is a function sets the LookUpTable with binary data.
- Parameters
body (byte array) – This API will return a byte array (Size(byte) : number of coordinates × 2 (X,Y) × 4 (float) )
-
PyJEM.detectorext.function.
set_mdp_enable
(sw: bool) → None¶ This API enables beam control with MDP.
- Parameters
sw (bool) –
False=> Mdp Enable Off.
True=> Mdp Enable On.
-
PyJEM.detectorext.function.
set_port
(val: str) → None¶ This function can modify the port number which is URI of this package.
- Parameters
val (int) – port numnber.
Warning
Please do not use it except for JEOL service.
-
PyJEM.detectorext.function.
snapshotall
() → dict¶ Acquire all available detectors.
- Returns
Execution result
- Return type
dict
Note
this function is only STEM mode.
Note
To get the acquired image data by this function, please to use snapshotframe() function.