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_by_ids |
Get many parameters by their IDs. |
get_all |
Search for parameters by name or ID. |
search |
Search for parameters using free text and advanced filters. |
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
get_by_ids
get_by_ids(*, ids: list[ParameterId]) -> list[Parameter]
Get many parameters by their IDs.
Arbitrarily long ID lists are supported. Use this instead of repeated
get_by_id
calls when you already have several Parameter IDs to fetch. To find
parameters without knowing their IDs, use get_all.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ids
|
list[ParameterId]
|
The Parameter IDs to retrieve (format |
required |
Returns:
| Type | Description |
|---|---|
list[Parameter]
|
The parameters matching the provided IDs. Order is not guaranteed to match input IDs, and unknown IDs are omitted. |
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
search
search(
*,
text: str | None = None,
ids: ParameterId | list[ParameterId] | None = None,
created_by: str | list[str] | None = None,
data_template: str | list[str] | None = None,
parameter_group: str | list[str] | None = None,
contains_field: str | list[str] | None = None,
contains_text: str | list[str] | None = None,
source_field: str | list[str] | None = None,
additional_field: str | list[str] | None = None,
translation: str | list[str] | None = None,
metadata_filters: dict[str, Any] | None = None,
custom_fields: dict[str, Any] | None = None,
order_by: OrderBy = DESCENDING,
sort_by: str | None = None,
max_items: int | None = None,
) -> Iterator[ParameterSearchItem]
Search for parameters matching the given filters.
Returns lightweight, partially populated results. Results are returned as a lazily paginated iterator, so iterating fetches additional pages on demand. With no filters, searches across all accessible parameters.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Free-text query matched against parameter fields. |
None
|
ids
|
ParameterId or list[ParameterId]
|
Filter by Parameter ID(s) (format |
None
|
created_by
|
str or list[str]
|
Filter by creator display name(s). |
None
|
data_template
|
str or list[str]
|
Filter by data template name(s). |
None
|
parameter_group
|
str or list[str]
|
Filter by parameter group name(s). |
None
|
contains_field
|
str or list[str]
|
Field(s) to apply a contains search to. |
None
|
contains_text
|
str or list[str]
|
Text value(s) for the contains search. |
None
|
source_field
|
str or list[str]
|
Restrict which fields are included in each search result. |
None
|
additional_field
|
str or list[str]
|
Additional fields to include on each search result. |
None
|
translation
|
str or list[str]
|
Translation(s) to include in the search. |
None
|
metadata_filters
|
dict[str, Any]
|
Filter by custom field (metadata) values, keyed by field name. For string fields,
map the name to a list of values, for example |
None
|
custom_fields
|
dict[str, Any]
|
Custom field type definitions used to interpret |
None
|
order_by
|
OrderBy
|
Sort direction. Default |
DESCENDING
|
sort_by
|
str
|
Attribute to sort results by. |
None
|
max_items
|
int
|
Maximum number of items to return in total. If None, iterates over all matches. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[ParameterSearchItem]
|
A lazily paginated iterator of matching parameter search results. |
Source code in src/albert/collections/parameters.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | |
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.