nqrduck_autotm.controller#

Classes

AutoTMController(*args,Β **kwargs)

class nqrduck_autotm.controller.AutoTMController(*args: Any, **kwargs: Any)#
add_position(frequency: str, tuning_position: str, matching_position: str) None#

Add a position to the lookup table.

Parameters:
  • frequency (str) – The frequency of the position.

  • tuning_position (str) – The tuning position.

  • matching_position (str) – The matching position.

calculate_calibration() None#

This method is called when the calculate calibration button is pressed. It calculates the calibration from the short, open and calibration data points.

@TODO: Improvements to the calibrations can be made the following ways:

1. The ideal values for open, short and load should be measured with a VNA and then be loaded for the calibration. The ideal values are probably not -1, 1 and 0 but will also show frequency dependent behaviour. 2 The AD8302 chip only returns the absolute value of the phase. One would probably need to calculate the phase with various algorithms found in the literature. Though Im not sure if these proposed algorithms would work for the AD8302 chip.

calculate_steps_for_absolute_move(target_position: int, stepper: Stepper) int#

Calculate the number of steps for an absolute move.

continue_or_finish_position_sweep(LUT)#

Continue or finish the position sweep.

continue_or_finish_voltage_sweep(LUT)#

This method is called when a voltage sweep is finished. It checks if the voltage sweep is finished or if the next voltage sweep should be started.

Parameters:

LUT (LookupTable) – The lookup table that is being generated.

export_calibration(filename: str) None#

This method is called when the export calibration button is pressed. It exports the data of the short, open and load calibration to a file.

Parameters:

filename (str) – The filename of the file to export to.

find_devices() None#

Scan for available serial devices and add them to the model as available devices.

finish_frequency_sweep()#

This method is called when a frequency sweep is finished. It hides the frequency sweep spinner dialog and adds the data to the model.

finish_position_sweep(LUT)#

Finish the position sweep.

finish_voltage_sweep(LUT)#

This method is called when a voltage sweep is finished. It hides the voltage sweep spinner dialog and adds the data to the model.

Args: LUT (LookupTable): The lookup table that is being generated.

generate_electrical_lut(start_frequency: str, stop_frequency: str, frequency_step: str) None#

This method is called when the generate LUT button is pressed. It generates a lookup table for the specified frequency range and voltage resolution.

Parameters:
  • start_frequency (str) – The start frequency in Hz.

  • stop_frequency (str) – The stop frequency in Hz.

  • frequency_step (str) – The frequency step in Hz.

generate_mechanical_lut(start_frequency: str, stop_frequency: str, frequency_step: str) None#

Generate a lookup table for the specified frequency range and voltage resolution.

Parameters:
  • start_frequency (str) – The start frequency in Hz.

  • stop_frequency (str) – The stop frequency in Hz.

  • frequency_step (str) – The frequency step in Hz.

go_to_position(tuning_position: int, matching_position: int) None#

Go to the specified position.

Parameters:

position (SavedPosition) – The position to go to.

handle_connection(device: str) None#

Connect or disconnect to the specified device based on if there already is a connection.

Parameters:

device (str) – The device port to connect to.

@TODO: If the user actually want to connect to another device while already connected to one, this would have to be handled differently. But this doesn’t really make sense in the current implementation.

homing() None#

This method is used to send the command β€˜h’ to the atm system. This command is used to home the stepper motors of the atm system.

import_calibration(filename: str) None#

This method is called when the import calibration button is pressed. It imports the data of the short, open and load calibration from a file.

Parameters:

filename (str) – The filename of the file to import from.

load_measurement(filename: str) None#

Load measurement from file.

Parameters:

filename (str) – Path to file.

load_positions(path: str) None#

Load the saved positions from a json file.

Parameters:

path (str) – The path to the json file.

on_absolute_move(steps: str, stepper: Stepper = None) None#

This method is called when the absolute move button is pressed.

on_delete_position(position: SavedPosition) None#

Delete the specified position.

Parameters:

position (SavedPosition) – The position to delete.

on_go_to_position(position: SavedPosition) None#

Go to the specified position.

Parameters:

position (SavedPosition) – The position to go to.

on_load_calibration(start_frequency: float, stop_frequency: float) None#

This method is called when the load calibration button is pressed. It starts a frequency sweep in the specified range and then loads a calibration.

on_loading()#

This method is called when the module is loaded. It sets up the serial connection and connects the signals and slots.

on_open_calibration(start_frequency: float, stop_frequency: float) None#

This method is called when the open calibration button is pressed. It starts a frequency sweep in the specified range and then starts an open calibration.

on_ready_read() None#

This method is called when data is received from the serial connection.

on_relative_move(steps: str, stepper: Stepper = None) None#

This method is called when the relative move button is pressed.

on_short_calibration(start_frequency: float, stop_frequency: float) None#

This method is called when the short calibration button is pressed. It starts a frequency sweep in the specified range and then starts a short calibration.

on_stepper_changed(stepper: str) None#

This method is called when the stepper position is changed. It sends the command to the atm system to change the stepper position.

Parameters:

stepper (str) – The stepper that is being changed. Either β€˜tuning’ or β€˜matching’.

open_connection(device: str) None#

Open a connection to the specified device.

Parameters:

device (str) – The device port to connect to.

print_info(text: str) None#

This method is called when data is received from the serial connection. It prints the data to the info text box.

Parameters:

text (str) – The data received from the serial connection.

process_calibration_data(text: str) None#

This method is called when data is received from the serial connection during a calibration. It processes the data and adds it to the model.

Parameters:

calibration_type (str) – The type of calibration that is being performed.

process_frequency_sweep_data(text: str) None#

This method is called when data is received from the serial connection during a frequency sweep. It processes the data and adds it to the model.

process_measurement_data(text: str) None#

This method is called when data is received from the serial connection during a measurement. It processes the data and adds it to the model.

process_reflection_data(text)#

This method is called when data is received from the serial connection. It processes the data and adds it to the model.

Parameters:

text (str) – The data received from the serial connection.

process_signalpath_data(text: str) None#

This method is called when data is received from the serial connection. It processes the data and adds it to the model.

Parameters:

text (str) – The data received from the serial connection.

process_signals(key: str, value: object) None#

Processes the signals from the module.

Implement this method in the subclass.

process_voltage_sweep_result(text: str) None#

This method is called when data is received from the serial connection during a voltage sweep. It processes the data and adds it to the model.

Parameters:

text (str) – The data received from the serial connection.

read_position_data(text: str) None#

This method is called when data is received from the serial connection.

read_reflection(frequency) float#

Starts a reflection measurement and reads the reflection at the specified frequency.

save_measurement(filename: str) None#

Save measurement to file.

Parameters:

filename (str) – Path to file.

save_positions(path: str) None#

Save the current positions to a json file.

Parameters:

path (str) – The path to the json file.

send_command(command: str) bool#

This method is used to send a command to the active serial connection.

Parameters:

command (str) – The command that should be send to the atm system.

Returns:

True if the command was send successfully, False otherwise.

Return type:

bool

send_stepper_command(steps: int, stepper: Stepper) None#

Send a command to the stepper motor based on the number of steps.

set_voltages(tuning_voltage: str, matching_voltage: str) None#

This method is called when the set voltages button is pressed. It writes the specified tuning and matching voltage to the serial connection.

Parameters:
  • tuning_voltage (str) – The tuning voltage in V.

  • matching_voltage (str) – The matching voltage in V.

start_frequency_sweep(start_frequency: str, stop_frequency: str) None#

This starts a frequency sweep on the device in the specified range. The minimum start and stop frequency are specific to the AD4351 based frequency generator.

Parameters:
  • start_frequency (str) – The start frequency in MHz.

  • stop_frequency (str) – The stop frequency in MHz.

start_next_mechTM(LUT)#

Start the next mechanical tuning and matching sweep.

start_next_voltage_sweep(LUT)#

This method is called when a voltage sweep is finished. It starts the next voltage sweep.

Parameters:

LUT (LookupTable) – The lookup table that is being generated.

switch_to_atm() None#

This method is used to send the command β€˜ca’ to the atm system. This switches the signal pathway of the atm system to β€˜RX’ to β€˜ATM. In this state the atm system can be used to measure the reflection coefficient of the probecoils.

switch_to_preamp() None#

This method is used to send the command β€˜cp’ to the atm system. This switches the signal pathway of the atm system to β€˜RX’ to β€˜Preamp’. This is the mode for either NQR or NMR measurements or if on wants to check the tuning of the probe coil on a network analyzer.

tune_and_match(frequency: float) None#

This method is called when this module already has a LUT table. It should then tune and match the probe coil to the specified frequency.

validate_position(future_position: int, stepper: Stepper) bool#

Validate the stepper’s future position.