leicascanningtemplate API reference¶
-
class
leicascanningtemplate.
ScanningTemplate
(filename)[source]¶ Bases:
object
Python object of Leica LAS Matrix Screener Scanning Template XML. Provides easy access to elements via attributes:
>>> tmpl = ScanningTemplate('{ScanningTemplate}tmpl.xml') >>> # attributes of MatrixScreenerTemplate/ScanningTemplate/Properties >>> print(tmpl.properties.attrib)
Parameters: filename (str) – XML to load. -
filename
¶ str
Path XML-filename.
-
root
¶ lxml.objectify.ObjectifiedElement
Objectified root of loaded XML. See http://lxml.de/objectify.html#the-lxml-objectify-api
-
add_well
(well_x, well_y, start_x, start_y)[source]¶ Add well with associated scan fields.
self.wells[0]
andself.fields[0]
will be used as base. ScanWellData will be added to ScanWellArray and ScanFieldData to ScanFieldArray. The amount of fields added is decided by Properties/CountOfScanFields.Parameters: - well_x (int) –
- well_y (int) –
- start_x (int) – In meters. FieldXCoordinate of first field in well.
- start_y (int) – In meters. FieldYCoordinate of first field in well.
Raises: ValueError
– If well or fields already exists.
-
count_of_assigned_jobs
¶ Number of fields that have attrib[‘JobAssigned’] set to true.
-
count_of_wells
¶ Number of wells in x/y-direction of template.
Returns: (xs, ys) number of wells in x and y direction. Return type: tuple
-
field
(well_x=1, well_y=1, field_x=1, field_y=1)[source]¶ ScanFieldData of specified field.
Parameters: - well_x (int) –
- well_y (int) –
- field_x (int) –
- field_y (int) –
Returns: ScanFieldArray/ScanFieldData element.
Return type: lxml.objectify.ObjectifiedElement
-
field_array
¶ Short hand for
self.root.ScanFieldArray
-
fields
¶ All ScanFieldData elements.
Returns: Return type: list of objectify.ObjectifiedElement
-
move_well
(well_x, well_y, start_x, start_y)[source]¶ Move well and associated scan fields. Spacing between fields will be what Properties/ScanFieldStageDistance is set to.
Parameters: - well_x (int) –
- well_y (int) –
- start_x (int) – In meters. FieldXCoordinate of first field in well.
- start_y (int) – In meters. FieldYCoordinate of first field in well.
Raises: ValueError
– If specified well or associated fields does not exist.
-
properties
¶ Short hand for
self.root.ScanningTemplate.Properties
-
remove_well
(well_x, well_y)[source]¶ Remove well and associated scan fields.
Parameters: - well_x (int) –
- well_y (int) –
Raises: AttributeError
– If well not found.
-
update_well_positions
()[source]¶ Set
well_attrib['FieldXStartCoordinate']
andwell_attrib['FieldYStartCoordinate']
to FieldXCoordinate and FieldYCoordinate of first field in well.
-
well
(well_x=1, well_y=1)[source]¶ ScanWellData of specific well.
Parameters: - well_x (int) –
- well_y (int) –
Returns: Return type: lxml.objectify.ObjectifiedElement
-
well_array
¶ Short hand for
self.root.ScanWellArray
-
well_attrib
(well_x=1, well_y=1)[source]¶ Attributes of specific well.
Parameters: - well_x (int) –
- well_y (int) –
Returns: Attributes of ScanWellArray/ScanWellData.
Return type: dict
-
well_fields
(well_x=1, well_y=1)[source]¶ All ScanFieldData elements of given well.
Parameters: - well_x (int) –
- well_y (int) –
Returns: All ScanFieldData elements of given well.
Return type: list of lxml.objectify.ObjectifiedElement
-
wells
¶ All ScanWellData elements.
Returns: Return type: list of objectify.ObjectifiedElement
-