pyccapt.control.devices package
Submodules
pyccapt.control.devices.camera module
- class pyccapt.control.devices.camera.CameraWorker(*args: Any, **kwargs: Any)[source]
Bases:
QObjectDrives Basler camera capture with hot-reconnect support.
The worker keeps a fixed number of slots (one per logical camera in the GUI) and binds each slot to a physical camera by serial number the first time it sees one. If a camera disappears, its slot is freed and the worker keeps trying to (re)attach it. Other slots keep streaming.
- disconnect_serial(serial)[source]
Close any open slot bound to serial and prevent auto-reattach.
Use
connect_serial()to re-enable it.
- list_cameras()[source]
Return one dict per currently-detected Basler camera.
Each dict has
serial,model,slot(or None when the device is detected but not bound),attached(bool), anduser_disabled(bool — user explicitly disconnected it).
- set_auto_exposure_time()
- set_default_exposure_time()
- set_exposure_time_1(exposure_time)
- set_exposure_time_2(exposure_time)
- set_exposure_time_3(exposure_time)
- RECONNECT_INTERVAL = 3.0
- SLOT_COUNT = 2
- pyccapt.control.devices.camera.check_camera_availability(required_cameras: int = 1) tuple[bool, str][source]
Compatibility wrapper.
Older call sites used this to gate whether the camera GUI could open at all. The GUI now always opens when the backend is loaded and the worker handles missing/disconnected cameras dynamically, so this just forwards to
check_camera_backend().
- pyccapt.control.devices.camera.check_camera_backend() tuple[bool, str][source]
Return whether the Basler camera backend is usable on this host.
A True result means we can enumerate Basler cameras at runtime. The actual number of connected cameras is allowed to fluctuate while the GUI is running, so the worker handles that dynamically; this check is only about whether pypylon itself is available.
pyccapt.control.devices.edwards_tic module
Driver for Edwards TIC / Active Gauge Controller (AGC) vacuum gauges.
Vendor / origin
The serial command set used here (!C910, !C904, ?V911,
?V940, etc.) is defined and owned by Edwards Vacuum for their
TIC / AGC vacuum-controller family. This file is a thin Python wrapper
around that ASCII serial protocol; the protocol itself is Edwards’
property. Refer to Edwards’ Active Gauge Controller manual for the
authoritative command reference.
- class pyccapt.control.devices.edwards_tic.EdwardsAGC(port, variables)[source]
Bases:
objectPrimitive driver for Edwards Active Gauge Controller. Complete manual found at http://www.idealvac.com/files/brochures/Edwards_AGC_D386-52-880_IssueM.pdf
The constructor function to initialize serial lib parameters.
- Parameters:
port (str) – Port on which serial communication is established.
variables – Variable container for shared variables.
- Returns:
None
pyccapt.control.devices.email_send module
Experiment-finished email notification.
Configuration lives in pyccapt/files/email_credentials.toml (TOML).
That file is gitignored. A checked-in template email_credentials.example.toml
documents the schema; users copy it to the real name and fill in their SMTP
account.
Backwards compatibility: if the TOML file is absent but the legacy
email_pass.txt exists, the password is read from there and the rest of
the SMTP config falls back to the historical Gmail defaults.
Failures (missing config, missing recipient, SMTP errors) raise rather
than silently swallow, so callers can log them via apt.log.
- exception pyccapt.control.devices.email_send.EmailNotConfigured[source]
Bases:
RuntimeErrorRaised when no usable credentials file is present.
- pyccapt.control.devices.email_send.send_email(email: str, subject: str, message: str, variables=None) list[str][source]
Send the experiment-finished email.
- Parameters:
email – Recipient address (the operator’s address from the GUI).
subject – Email subject.
message – Plain-text body.
variables – Optional shared experiment variables; if provided, the experiment’s
apt.logandparameters.txtare attached.
- Returns:
List of attached filenames (may be empty).
- Raises:
EmailNotConfigured – if no credentials file is set up.
ValueError – if the recipient address is empty.
smtplib.SMTPException / OSError – on SMTP/network failure.
pyccapt.control.devices.initialize_devices module
- class pyccapt.control.devices.initialize_devices.bcolors[source]
Bases:
object- BOLD = '\x1b[1m'
- ENDC = '\x1b[0m'
- FAIL = '\x1b[91m'
- HEADER = '\x1b[95m'
- OKBLUE = '\x1b[94m'
- OKCYAN = '\x1b[96m'
- OKGREEN = '\x1b[92m'
- UNDERLINE = '\x1b[4m'
- WARNING = '\x1b[93m'
- pyccapt.control.devices.initialize_devices.command_cryovac(cmd, com_port_cryovac)[source]
Execute a command on Cryovac through serial communication.
Vendor / origin
The CLI command set used here (
getOutput,getOutputNames,Out1Cryo.PID.Setpoint,Out2LL.PID.Setpoint,e_mlp-style queries, etc.) is defined and owned by CryoVac GmbH for their TIC 500 programmable temperature controller. This function and its siblings (initialize_cryovacetc.) are thin wrappers around that ASCII serial protocol; the protocol itself is CryoVac’s property. Refer to the CryoVac TIC 500 manual (e.g. document 5984591) for the authoritative reference.- param cmd:
Command to be executed.
- param com_port_cryovac:
Serial communication object.
- returns:
Response code after executing the command.
- pyccapt.control.devices.initialize_devices.command_edwards(conf, variables, cmd, E_AGC, status=None)[source]
Execute commands and set flags based on parameters.
- Parameters:
conf – Configuration parameters.
variables – Variables instance.
cmd – Command to be executed.
E_AGC – EdwardsAGC instance.
status – Status of the lock.
- Returns:
Response code after executing the command.
- pyccapt.control.devices.initialize_devices.initialize_cryovac(com_port_cryovac, variables)[source]
Initialize the communication port of Cryovac.
- Parameters:
com_port_cryovac – Serial communication object.
variables – Variables instance.
- Returns:
None
- pyccapt.control.devices.initialize_devices.initialize_edwards_tic_buffer_chamber(conf, variables)[source]
Initialize TIC buffer chamber parameters.
- Parameters:
conf – Configuration parameters.
variables – Variables instance.
- Returns:
None
- pyccapt.control.devices.initialize_devices.initialize_edwards_tic_cryo_load_lock(conf, variables)[source]
Initialize TIC cryo load lock parameters.
- Parameters:
conf – Configuration parameters.
variables – Variables instance.
- Returns:
None
- pyccapt.control.devices.initialize_devices.initialize_edwards_tic_load_lock(conf, variables)[source]
Initialize TIC load lock parameters.
- Parameters:
conf – Configuration parameters.
variables – Variables instance.
- Returns:
None
- pyccapt.control.devices.initialize_devices.initialize_pfeiffer_gauges(variables)[source]
Initialize Pfeiffer gauge parameters.
- Parameters:
variables – Variables instance.
- Returns:
None
- pyccapt.control.devices.initialize_devices.log_vacuum_levels(main_chamber, buffer_chamber, buffer_chamber_pre, load_lock, load_lock_pre, cryo_load_lock, cryo_load_lock_pre)[source]
Log vacuum levels to a text file and a CSV file.
- Parameters:
main_chamber (float) – Vacuum level of the main chamber.
buffer_chamber (float) – Vacuum level of the buffer chamber.
buffer_chamber_pre (float) – Vacuum level of the buffer chamber backing pump.
load_lock (float) – Vacuum level of the load lock.
load_lock_pre (float) – Vacuum level of the load lock backing pump.
cryo_load_lock (float) – Vacuum level of the cryo load lock.
cryo_load_lock_pre (float) – Vacuum level of the cryo load lock backing pump.
- Returns:
None
pyccapt.control.devices.pfeiffer_gauges module
Driver for Pfeiffer TPG 362 (and family) vacuum-gauge controllers.
Vendor / origin
The mnemonic command set used in this module (PR1, PR2,
UNI, ETX, ENQ, gauge-status codes, etc.) is defined and
owned by Pfeiffer Vacuum GmbH for their TPG 26x / TPG 36x series
single- and dual-channel vacuum measurement and control units. This
file is a thin Python wrapper around that ASCII serial protocol.
See Pfeiffer’s “TPG 261 / 262 Communication Protocol” and “TPG 361 / 362 Operating Instructions” for the authoritative specification.
- class pyccapt.control.devices.pfeiffer_gauges.TPG26x(port='/dev/ttyUSB0', baudrate=9600)[source]
Bases:
objectAbstract class that implements the common driver for the TPG 261 and TPG 262 dual channel measurement and control unit.
Initialize the TPG26x driver.
- gauge_identification()[source]
Return the gauge identification.
- Returns:
Identification codes and messages for both gauges.
- Return type:
- pressure_gauges()[source]
Return the pressures measured by the gauges.
- Returns:
The values of both gauges along with their status codes and messages.
- Return type:
- rs232_communication_test()[source]
Test the RS232 communication.
- Returns:
The status of the communication test.
- Return type:
- ACK = '\x06'
- CR = '\r'
- ENQ = '\x05'
- ETX = '\x03'
- LF = '\n'
- NAK = '\x15'
pyccapt.control.devices.signal_generator module
- pyccapt.control.devices.signal_generator.change_frequency_signal_generator(variables, freq)[source]
Change the frequency of the signal generator.
- Parameters:
variables – Instance of variables class.
freq – Frequency at which signal needs to be generated.
- Returns:
None