instrumentserver.params#
Functions
|
|
|
Classes
|
A virtual instrument that acts as a manager for a collection of arbitrary parameters and groups of parameters. |
|
- class instrumentserver.params.ParameterManager(name: str)[source]#
Bases:
InstrumentBaseA virtual instrument that acts as a manager for a collection of arbitrary parameters and groups of parameters.
Allows extra-easy on-the-fly addition/removal of new parameters.
For the parameter manager to recognize other profiles in disk, the profile filename needs to start with ‘parameter_manager-’ and end with ‘.json’ with the name of the profile in the middle. For example, ‘parameter_manager-qubit1.json’ represents the profile qubit1
- add_parameter(name: str, **kw: Any) None[source]#
Add a parameter.
- Parameters:
name – Name of the parameter. If the name contains .`s, then an element before a dot is interpreted as a submodule. Multiple dots represent nested submodules. I.e., when we supply ``foo.bar.foo2` we have a top-level submodule
foo, containing a submodulebar, containing the parameterfoo2. Submodules are generated on demand.kw – Any keyword arguments will be passed on to qcodes.Instrument.add_parameter, except: -
set_cmdis always set toNone-parameter_classisqcodes.Parameter-valsdefaults toqcodes.utils.validators.Anything().
- Returns:
None.
- static cleanProfileName(name: str) str[source]#
When passed the full file name of a parameter_manager profile, return only the middle string representing the profile’s name.
- static createFromParamDict(paramDict: Dict[str, Any], name: str) ParameterManager[source]#
Create a new ParameterManager instance from a paramDict.
- Parameters:
paramDict – The paramDict object.
name – Name of the instrument in the paramDict (each entry in the paramDict starts with <instrumentName>.[…]).
- Returns:
New ParameterManager instance.
- fromFile(filePath: str | None = None, deleteMissing: bool = True) None[source]#
Load parameters from a parameter json file (see
serialize).If the filepath starts with ‘parameter_manager-’ and ends with ‘.json’, selectedProfile is changed to the filename.
- Parameters:
filePath – Path to the json file. If
Noneit looks in the instrument current location directory for a file called “parametermanager_parameters.json”.deleteMissing – If
True, delete parameters currently in the ParameterManager that are not listed in the file.
- fromParamDict(paramDict: Dict[str, Any], deleteMissing: bool = True) None[source]#
Load parameters from a parameter dictionary (see
serialize).- Parameters:
paramDict – Parameter dictionary.
deleteMissing – If
True, delete parameters currently in the ParameterManager that are not listed in the file.
- static fullProfileName(name: str) str[source]#
Adds ‘parameter_manager-’ to the beginning of name and adds ‘.json’ at the end.
- get(param_name: str) Any[source]#
Shortcut for getting a parameter from its name.
- Parameters:
param_name – The name of a parameter of this instrument.
- Returns:
The current value of the parameter.
Note
This is deprecated. Call get directly on the parameter.
- parameter(name: str) ParameterBase[source]#
Get a parameter object from the manager.
- Parameters:
name – the full name
- Returns:
the parameter
- refresh_profiles() List[str][source]#
Goes into the working directory and updates the list of profiles.
- Returns:
List of profiles in the working directory
- remove_parameter(param_name: str, cleanup: bool = True) None[source]#
Remove a Parameter from this instrument.
Unlike modifying the parameters dict directly, this method will make sure that the parameter is properly unbound from the instrument if the parameter is added as a real attribute to the instrument. If a property of the same name exists it will not be modified. If name is an attribute but not a parameter, it will not be modified.
- Parameters:
name – The name of the parameter to remove.
- Raises:
KeyError – If the parameter does not exist on the instrument.
- selectedProfile#
default location and name of the parameters save file.
- set(param_name: str, value: Any) Any[source]#
Shortcut for setting a parameter from its name and new value.
- Parameters:
param_name – The name of a parameter of this instrument.
value – The new value to set.
Note
This is deprecated. Call set directly on the parameter.
- toFile(filePath: str | None = None, name: str | None = None) None[source]#
Save parameters from the instrument into a json file. If the file being saved is a profile file (starts with ‘parameter_manager-’ and ends with ‘.json’), the selectedProfile is changed to the filename.
- Parameters:
filePath – Path to the json file. If
Noneit looks in the instrument current working directory for a file called “parameter_manager-<name_of_this_instrument>.json”.name – If the filePath passed is a directory, The name of the file that it will create follows the convention of “parameter_manager-<name>.json”. If none it will name it the name of the instrument.
- class instrumentserver.params.ParameterTypes(*values)[source]#
Bases:
Enum- any = 1#
- bool = 5#
- complex = 6#
- integer = 3#
- numeric = 2#
- string = 4#
- instrumentserver.params.paramTypeFromName(name: str) ParameterTypes | None[source]#