# devices.oxford:MercurySingleAxisIPS


Driver for Mercury-IPS.


Usage

``` python
devices.oxford:MercurySingleAxisIPS(
    interface,
    maxfield=5,
    maxrate=0.5,
)
```


Query the dictionaries for the values you want to read; the results are written to the dictionaries and can then be read with the given functions.

Dicts for functions: confDictX/Y/Z for magnetic field status (to Setpoint etc.) dataDictX/Y/Z for magnetic field functions confDictLevel for Helium Fast/Slow dataDictLevel for Helium/Nitrogen Levels

Usually all relevant parameters for operation can be found in the workingDict.


## Methods

| Name | Description |
|----|----|
| [__init__()](#__init__) | Initialize the Mercury single axis IPS device. |
| [getDictValue()](#getDictValue) | Get a value from the working dictionary. |
| [getFastRate()](#getFastRate) | Get the helium level meter mode. |
| [getLevels()](#getLevels) | Get the liquid nitrogen and helium levels. |
| [getMagnetStatus()](#getMagnetStatus) | Get the status of the magnet. |
| [getMagneticFieldRate()](#getMagneticFieldRate) | Get the rate of change for the magnetic field. |
| [getMagneticFields()](#getMagneticFields) | Get the current magnetic field values. |
| [getVoltage()](#getVoltage) | Get the current output voltage. |
| [logAllDicts()](#logAllDicts) | Log the contents of all dictionaries for debugging. |
| [query()](#query) | Query a value from the device. |
| [queryAllDicts()](#queryAllDicts) | Query all dictionaries to update their values. |
| [queryDict()](#queryDict) | Query all entries in a dictionary. |
| [queryID()](#queryID) | Query the device ID. |
| [queryLevelMeter()](#queryLevelMeter) | Query the level meter configuration. |
| [queryLevelMeterStatus()](#queryLevelMeterStatus) | Query the level meter status. |
| [queryMagnetConf()](#queryMagnetConf) | Query the magnet configuration. |
| [queryMagnetStatus()](#queryMagnetStatus) | Query the magnet status. |
| [querySysConf()](#querySysConf) | Query the system configuration. |
| [queryWorkingDict()](#queryWorkingDict) | Query all entries in the working dictionary. |
| [setFastRate()](#setFastRate) | Set the helium level meter to fast or slow mode. |
| [setMagnetStatus()](#setMagnetStatus) | Set the status of the magnet. |
| [setMagneticField()](#setMagneticField) | Set the magnetic field on the x axis. |
| [setMagneticFieldRate()](#setMagneticFieldRate) | Set the rate of change for the magnetic field. |
| [setVal()](#setVal) | Set a value on the device. |

------------------------------------------------------------------------


### \_\_init\_\_()


Initialize the Mercury single axis IPS device.


Usage

``` python
__init__(
    interface,
    maxfield=5,
    maxrate=0.5,
)
```


#### Parameters


`interface: str`  
VISA resource name

`maxfield: float = ``5`  
Maximum allowed field, by default 5

`maxrate: float = ``0.5`  
Maximum allowed rate, by default 0.5


------------------------------------------------------------------------


### getDictValue()


Get a value from the working dictionary.


Usage

``` python
getDictValue(key)
```


#### Parameters


`key: str`  
Key in the working dictionary


#### Returns


`float or bool`  
Value from the working dictionary


------------------------------------------------------------------------


### getFastRate()


Get the helium level meter mode.


Usage

``` python
getFastRate()
```


#### Returns


`bool`  
True if in slow mode, False if in fast mode


------------------------------------------------------------------------


### getLevels()


Get the liquid nitrogen and helium levels.


Usage

``` python
getLevels()
```


#### Returns


`tuple`  
(LN2 level, LHe level)


------------------------------------------------------------------------


### getMagnetStatus()


Get the status of the magnet.


Usage

``` python
getMagnetStatus(axis=0)
```


#### Parameters


`axis: int = ``0`  
Axis to query (-1=all, 0=x), by default 0


#### Returns


`int or list`  
Status of the magnet: 0 - HOLD 1 - RTOS (Ramp to setpoint) 2 - RTOZ (Ramp to zero) 3 - CLMP (Clamped, when current is 0)


------------------------------------------------------------------------


### getMagneticFieldRate()


Get the rate of change for the magnetic field.


Usage

``` python
getMagneticFieldRate(
    axis=0,
    setp=False,
)
```


#### Parameters


`axis: int = ``0`  
Axis to query (0=x, -1=all), by default 0

`setp: bool = ``False`  
If True, also return the setpoint, by default False


#### Returns


`float or tuple or list`  
Current rate value(s), and setpoint(s) if requested


------------------------------------------------------------------------


### getMagneticFields()


Get the current magnetic field values.


Usage

``` python
getMagneticFields(setp=False)
```


#### Parameters


`setp: bool = ``False`  
If True, also return the setpoints, by default False


#### Returns


`tuple`  
Current field value(s), and setpoint(s) if requested


------------------------------------------------------------------------


### getVoltage()


Get the current output voltage.


Usage

``` python
getVoltage()
```


#### Returns


`float`  
Current output voltage


------------------------------------------------------------------------


### logAllDicts()


Log the contents of all dictionaries for debugging.


Usage

``` python
logAllDicts()
```


------------------------------------------------------------------------


### query()


Query a value from the device.


Usage

``` python
query(
    command,
    address="",
    signal=False,
)
```


#### Parameters


`command: str`  
Command to send

`address: str = ``""`  
Device address, by default ""

`signal: bool = ``False`  
Whether to use the signal variant of the command, by default False


#### Returns


`str`  
Response from the device


------------------------------------------------------------------------


### queryAllDicts()


Query all dictionaries to update their values.


Usage

``` python
queryAllDicts()
```


------------------------------------------------------------------------


### queryDict()


Query all entries in a dictionary.


Usage

``` python
queryDict(
    queryDict,
    address="",
    signal=False,
)
```


#### Parameters


`queryDict: dict`  
Dictionary containing commands as keys

`address: str = ``""`  
Device address, by default ""

`signal: bool = ``False`  
Whether to use the signal variant of the command, by default False


------------------------------------------------------------------------


### queryID()


Query the device ID.


Usage

``` python
queryID()
```


------------------------------------------------------------------------


### queryLevelMeter()


Query the level meter configuration.


Usage

``` python
queryLevelMeter()
```


------------------------------------------------------------------------


### queryLevelMeterStatus()


Query the level meter status.


Usage

``` python
queryLevelMeterStatus()
```


------------------------------------------------------------------------


### queryMagnetConf()


Query the magnet configuration.


Usage

``` python
queryMagnetConf()
```


------------------------------------------------------------------------


### queryMagnetStatus()


Query the magnet status.


Usage

``` python
queryMagnetStatus()
```


------------------------------------------------------------------------


### querySysConf()


Query the system configuration.


Usage

``` python
querySysConf()
```


------------------------------------------------------------------------


### queryWorkingDict()


Query all entries in the working dictionary.


Usage

``` python
queryWorkingDict()
```


Updates the values in the working dictionary with current device values.


------------------------------------------------------------------------


### setFastRate()


Set the helium level meter to fast or slow mode.


Usage

``` python
setFastRate(slow=True)
```


#### Parameters


`slow: bool = ``True`  
True for slow mode, False for fast mode, by default True


------------------------------------------------------------------------


### setMagnetStatus()


Set the status of the magnet.


Usage

``` python
setMagnetStatus(
    state,
    axis=0,
)
```


#### Parameters


`state: int or list`  
Status to set: 0 - HOLD 1 - RTOS (Ramp to setpoint) 2 - RTOZ (Ramp to zero) 3 - CLMP (Clamped, when current is 0) - disallowed

`axis: int = ``0`  
Axis to set (-1=take state as list, 0=x), by default 0


#### Notes

Status 3 (CLMP) is disallowed as it could damage the magnet.

------------------------------------------------------------------------


### setMagneticField()


Set the magnetic field on the x axis.


Usage

``` python
setMagneticField(xval)
```


#### Parameters


`xval: float`  
Target magnetic field value


#### Notes

Values exceeding the maximum field limits will be clamped.

------------------------------------------------------------------------


### setMagneticFieldRate()


Set the rate of change for the magnetic field.


Usage

``` python
setMagneticFieldRate(
    rate,
    axis=0,
)
```


#### Parameters


`rate: float`  
Rate of change in T/min, must be between 0 and maxrate

`axis: int = ``0`  
Axis to set (0=x), by default 0


#### Notes

Values outside the allowed range will be clamped.

------------------------------------------------------------------------


### setVal()


Set a value on the device.


Usage

``` python
setVal(
    setpoint,
    command,
    address="",
    signal=False,
)
```


#### Parameters


`setpoint: float or str`  
Value to set

`command: str`  
Command to use

`address: str = ``""`  
Device address, by default ""

`signal: bool = ``False`  
Whether to use the signal variant of the command, by default False


#### Returns


`str`  
Response from the device
