nqontrol.general package

Submodules

nqontrol.general.errors module

Error classes for NQontrol.

exception nqontrol.general.errors.NQontrolError(message)[source]

Bases: Exception

Base Error Class.

exception nqontrol.general.errors.ConfigurationError(message)[source]

Bases: nqontrol.general.errors.NQontrolError

Errors due to misconfiguration.

exception nqontrol.general.errors.UserInputError(message)[source]

Bases: nqontrol.general.errors.NQontrolError

Wrong user input.

exception nqontrol.general.errors.Bug(message)[source]

Bases: nqontrol.general.errors.NQontrolError

Found a bug.

exception nqontrol.general.errors.DeviceError(message)[source]

Bases: nqontrol.general.errors.NQontrolError

The ADwin device shows unexpected behaviour.

exception nqontrol.general.errors.AutoLockError(message)[source]

Bases: nqontrol.general.errors.NQontrolError

Exceptions regarding the autolock.

exception nqontrol.general.errors.AutoLockAnalysisError(message)[source]

Bases: nqontrol.general.errors.AutoLockError

Analysis was not successful.

nqontrol.general.helpers module

nqontrol.general.helpers.setBit(x, offset)[source]
nqontrol.general.helpers.clearBit(x, offset)[source]
nqontrol.general.helpers.testBit(x, offset)[source]
nqontrol.general.helpers.changeBit(x, offset, enabled)[source]
nqontrol.general.helpers.readBit(x, offset)[source]
nqontrol.general.helpers.convertVolt2Float(value: Union[list, numpy.number, numpy.ndarray], mode: int = 0, signed=False)Union[float, numpy.ndarray][source]

Converts a volt scala value (in case of ADwin e.g. volt range from -10 to 10, because the outputs are limited) to a Float value. The supported range is divided onto the whole 16-bit float, so -10 Volt would e.g. correspond with 0, 10 V with 65535 for unsigned or -32768 to 32767 when signed.

Parameters
  • value (list, numpy.number, numpy.ndarray) – The value(s) to be converted.

  • mode (int) – Integer from 0 to 3, sensitivity mode. Decides how the bins are divided. See nqontrol.servo.inputSensitivity or auxSensitivity for more info.

  • signed (bool) – Whether the Integer is supposed to have a sign or not, see above.

Returns

Converted value. Exact type depends on input type.

Return type

list, numpy.number, numpy.ndarray

nqontrol.general.helpers.convertVolt2Int(value: Union[list, numpy.number, numpy.ndarray], mode: int = 0, signed=False)Union[int, numpy.ndarray][source]

[DEPRECATED] Converts a volt scala value (in case of ADwin e.g. volt range from -10 to 10, because the outputs are limited) to an Integer value. There is an equivalent function for Floats. The supported range is divided onto the whole 16-bit integer, so -10 Volt would e.g. correspond with 0, 10 V with 65535 for unsigned or -32768 to 32767 when signed.

Parameters
  • value (list, numpy.number, numpy.ndarray) – The value(s) to be converted.

  • mode (int) – Integer from 0 to 3, sensitivity mode. Decides how the bins are divided. See nqontrol.servo.inputSensitivity or auxSensitivity for more info.

  • signed (bool) – Whether the Integer is supposed to have a sign or not, see above.

Returns

Converted value. Exact type depends on input type.

Return type

list, numpy.number, numpy.ndarray

nqontrol.general.helpers.convertFloat2Volt(value: Union[List[float], numpy.array, float], mode: int = 0, signed=False)Union[float, numpy.ndarray][source]

Convert float to volt.

For details see convertVolt2Float.

Parameters
  • value (Union[List[float], np.array, float]) – value is a 16 bit number

  • mode (int) – mode is the input amplification mode

  • signed

Returns

returnVar

Return type

Union[float, np.ndarray]

nqontrol.general.helpers.rearrange_filter_coeffs(inputFilter: List[float])List[float][source]

Rearrage coefficients from a, b to c.

nqontrol.general.helpers.convertStepsize2Frequency(stepsize: float)float[source]
nqontrol.general.helpers.convertFrequency2Stepsize(frequency: float)float[source]

nqontrol.general.mockAdwin module

class nqontrol.general.mockAdwin.MockADwin(DeviceNo=0, raiseError=False)[source]

Bases: object

Mock class for testing and demonstration of nqontrol

NUM_SERVOS = 8
Boot(file_)[source]
Workload()[source]
Process_Status(no)[source]
Load_Process(process)[source]
Start_Process(no)[source]
Set_FPar(index, par)[source]
Set_Par(index, par)[source]
Get_Par(index)[source]
Get_FPar(index)[source]
GetData_Double(DataNo, Startindex, Count)[source]
SetData_Double(Data, DataNo, Startindex, Count)[source]
GetData_Long(DataNo, Startindex, Count)[source]
SetData_Long(Data, DataNo, Startindex, Count)[source]
Fifo_Full(index)[source]
GetFifo_Double(index, amount)[source]

GetFifo_Double returns a list of the fifo buffer.

Parameters
  • index – index of the list

  • amount – number of entries

Returns

Return type

list

Get_Processdelay(index)[source]

nqontrol.general.settings module

Module contents