scitacean.Profile#
- class scitacean.Profile(url, file_transfer, frontend_url=None, scientific_metadata_schema='plain', field_factories=<factory>)[source]#
Parameters for connecting to a specific instance of SciCat.
The fields of a profile correspond to the arguments of the constructors of
Client. They can be overridden by the explicit constructor arguments.When constructing a client from a profile, the
profileargument may be one of:If
profileis aProfile, it is returned as is.- If
profileis astr, a builtin profile with that name is constructed if possible.
- If
Constructors
__init__(url, file_transfer[, frontend_url, ...])Attributes
URL of the SciCat API.
A file transfer object for uploading and downloading files.
URL of the SciCat frontend.
The schema used for scientific metadata.
Mapping of field names to functions that compute field values.
- __init__(url, file_transfer, frontend_url=None, scientific_metadata_schema='plain', field_factories=<factory>)#
-
field_factories:
dict[str,Callable[...,Any]]# Mapping of field names to functions that compute field values.
Each item is a pair of field name and a function that computes a value for that field from other fields. The function can take any number of arguments. When calling a factory the arguments are provided based on the dataset that a field is being built for. See the example below.
Field names can be any dataset field plus the following:
instrumentNames: The names of the instruments based on instrument IDs if the Ids are known.
Scitacean itself does not currently use this field. It is only used by the Scitacean widget.
Note
All field names use the SciCat names (see Models) instead of the names used in
scitacean.Dataset. That is, e.g.,proposalIdsinstead ofproposal_idsorsourceFolderinstead ofsource_folder.Examples
Use the proposal ID of a dataset to construct the owner group:
>>> field_factories = { ... "ownerGroup": lambda proposalId: str(proposalIds[0]).strip(), ... }
Using
str()andstrip()here is just a cautionary measure, typically, the proposal ID should already be a stripped string.
-
file_transfer:
FileTransfer|None# A file transfer object for uploading and downloading files.
See the File transfer. section for implementations provided by Scitacean.
-
frontend_url:
str|None# URL of the SciCat frontend.
See
Profile.urlfor more information.
-
scientific_metadata_schema:
Literal['plain','value-unit']# The schema used for scientific metadata.
“plain”: No special handling. The metadata is used as provided by the user.
“value-unit”: The metadata is expected to be a dictionary with keys “value” and “unit”.
This is currently unused by Scitacean.