Parameters
albert.collections.parameters.ParameterCollection
Bases: BaseCollection
Manage Parameters in the Albert platform.
A Parameter (ID format PRM..., e.g. "PRM9999999") is the definition of a
single condition or input variable used when running experiments, such as
Temperature, Spin Speed, or Instrument. It is often called an "indirect
variable": the Parameter itself only names the variable, and its actual value
and unit are fixed to a setpoint later, inside a Workflow.
Parameters are the building blocks of Parameter Groups
(ParameterGroup) and form the
parameter side of Data Templates
(DataTemplate).
This collection is accessed as client.parameters.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
str
|
The base API route for parameter requests. |
Methods:
| Name | Description |
|---|---|
create |
Create a new parameter. |
get_or_create |
Return the existing parameter matching by name, or create it. |
get_by_id |
Get a single parameter by its ID. |
get_all |
Search for parameters by name or ID. |
update |
Update an existing parameter. |
delete |
Delete a parameter by its ID. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Source code in src/albert/collections/parameters.py
get_by_id
get_by_id(*, id: ParameterId) -> Parameter
Get a single parameter by its ID.
To find parameters without knowing their IDs, use get_all.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
ParameterId
|
The Parameter ID (format |
required |
Returns:
| Type | Description |
|---|---|
Parameter
|
The fully populated parameter. |
Source code in src/albert/collections/parameters.py
create
Create a new parameter.
This registers a new condition or input variable (e.g. Temperature or Spin
Speed) that can then be used in Parameter Groups and Data Templates. To
avoid creating duplicates when a parameter of the same name may already
exist, use get_or_create instead.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameter
|
Parameter
|
The parameter to create. Only |
required |
Returns:
| Type | Description |
|---|---|
Parameter
|
The newly created parameter, populated with its assigned Parameter ID. |
Source code in src/albert/collections/parameters.py
get_or_create
Return the existing parameter matching by name, or create it.
Matches an existing parameter by exact name. If a match is found, it is
returned unchanged; otherwise a new parameter is created via create.
Use this to avoid creating duplicate parameters.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameter
|
Parameter
|
The parameter to get or create. Matched on |
required |
Returns:
| Type | Description |
|---|---|
Parameter
|
The existing or newly created parameter. |
Source code in src/albert/collections/parameters.py
delete
delete(*, id: ParameterId) -> None
Delete a parameter by its ID.
This permanently removes the parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
ParameterId
|
The Parameter ID to delete (format |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/albert/collections/parameters.py
get_all
get_all(
*,
ids: list[ParameterId] | None = None,
names: str | list[str] = None,
exact_match: bool = False,
order_by: OrderBy = DESCENDING,
start_key: str | None = None,
max_items: int | None = None,
) -> Iterator[Parameter]
Search for parameters, optionally filtered by name or ID.
Results are returned as a lazily paginated iterator, so iterating fetches additional pages on demand. With no filters, iterates over all parameters.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ids
|
list[ParameterId]
|
Restrict results to these Parameter IDs (format |
None
|
names
|
str or list[str]
|
One or more parameter names to filter by. |
None
|
exact_match
|
bool
|
When True, only parameters whose name matches |
False
|
order_by
|
OrderBy
|
Sort direction. Default |
DESCENDING
|
start_key
|
str
|
Pagination key to resume from. Usually left unset. |
None
|
max_items
|
int
|
Maximum number of items to return in total. If None, iterates over all matches. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[Parameter]
|
A lazily paginated iterator of parameters matching the given criteria. |
Source code in src/albert/collections/parameters.py
update
Update an existing parameter.
Fetch the parameter (e.g. with get_by_id), modify the updatable
fields on the returned object, then pass it here. Only the fields listed in
Notes are applied; changes to other fields are ignored.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameter
|
Parameter
|
The parameter to update. Must have a valid |
required |
Returns:
| Type | Description |
|---|---|
Parameter
|
The updated parameter. |
Notes
The following fields can be updated: metadata, name.