pyicat_plus.client.null.IcatNullClient#
- class pyicat_plus.client.null.IcatNullClient(expire_datasets_on_close=True)[source]#
Bases:
IcatClientInterface- add_files(*args, **kwargs)[source]#
Add missing files to a dataset already ingested.
- Parameters:
dataset_id – The ICAT dataset identifier.
- Return type:
None
- do_log_in(*args, **kwargs)[source]#
Login to access the restricted part of the API.
- Parameters:
password
username – optional username
plugin – authentication plugin, defaults to ‘esrf’
- Return type:
None- Returns:
authentication info
- download_file_by(*args, **kwargs)[source]#
Download a file associated to a sample.
- Parameters:
sample_id – Sample identifier.
resource_id – Identifier of the resource/file to download.
use_chunks – Read the file in chunks or the entire file into memory at once.
chunk_size – Size of each chunk in bytes when use_chunks is True. Default is 8192 (8 KB).
- Return type:
None- Returns:
The content of the file as bytes.
- property expire_datasets_on_close: bool#
A flag indicating whether the dataset expires when it is closed or if it is synchronized with the metadata catalog.
- get_datasets_by(investigation_id=None, dataset_ids=None)#
Returns a list of dataset matching the provided criteria.
- Parameters:
investigation_id (
Optional[str]) – an investigationIddataset_ids (
Optional[str]) – comma separated list of dataset Ids
- Return type:
List[dict]
- get_investigations_by(*args, **kwargs)[source]#
Returns a list of investigations matching the provided criteria.
- Parameters:
filter
instrument_name
start_date
end_date
ids
- Return type:
None- Returns:
list of investigations
- get_parcels_by(*args, **kwargs)[source]#
Returns the list of parcels associated to an investigation.
- Parameters:
investigation_id
- Return type:
None- Returns:
list of parcel information
- get_sample_files_information_by(*args, **kwargs)[source]#
Returns the sample file information for a given sample.
- Parameters:
sample_id – Sample identifier.
- Return type:
None- Returns:
Sample file information as dict.
- get_sample_metadata_by(*args, **kwargs)[source]#
Returns the list of sample metadata associated to a proposal and a beamline.
- Parameters:
proposal – Proposal identifier (e.g., “hg237”).
beamline – Beamline identifier (e.g., “id13”).
session_start_date – Experiment session start date (format yyyy-MM-dd).
- Return type:
None- Returns:
List of sample metadata.
- get_samples_by(investigation_id=None, sample_ids=None)#
Returns a list of samples matching the provided criteria.
- Parameters:
investigation_id (
Optional[str]) – an investigationIdsample_ids (
Optional[str]) – comma separated list of sampleIds
- Return type:
List[dict]
- get_session_information(*args, **kwargs)[source]#
Returns the information about a session.
- Return type:
None- Returns:
session information
- investigation_info(*args, **kwargs)[source]#
Return the information of the experiment session corresponding to a beamline, proposal and date.
- Parameters:
beamline – The beamline name.
proposal – The proposal name.
date – The date of the proposal, current date by default.
allow_open_ended – If True, enable to select an unofficial experiment session.
timeout – Set a timeout for the ICAT request.
- Return type:
None- Returns:
If found, return the proposal, beamline, e-logbbok url and data portal url of the experiment session.
- investigation_info_string(*args, **kwargs)[source]#
Return the experiment session information as a string.
- Parameters:
beamline – The beamline name.
proposal – The proposal name.
date – The date of the proposal, current date by default.
allow_open_ended – If True, enable to select an unofficial experiment session.
timeout – Set a timeout for the ICAT request.
- Return type:
str- Returns:
If found, return the experiment session information from the metadata catalog as a string.
- investigation_summary(*args, **kwargs)[source]#
Return the experiment session information as a Tuple.
- Parameters:
beamline – The beamline name.
proposal – The proposal name.
date – The date of the proposal, current date by default.
allow_open_ended – If True, enable to select an unofficial experiment session.
timeout – Set a timeout for the ICAT request.
- Return type:
List[Tuple]- Returns:
If found, return the experiment session information from the metadata catalog as a Tuple.
- property reason_for_missing_information: str#
A string explaining why some information is missing in the metadata catalog.
- registered_dataset_ids(*args, **kwargs)[source]#
Return the dataset list of an experiment session.
- Parameters:
beamline – The beamline name of the proposal.
proposal – The proposal name.
date – The date of the proposal, current date by default.
allow_open_ended – If True, enable to select an unofficial experiment session.
timeout – Set a timeout for the ICAT request.
- Return type:
None- Returns:
The list of datasets (name and path).
- registered_datasets(*args, **kwargs)[source]#
Return the dataset information list of an experiment session.
- Parameters:
beamline – The beamline name of the proposal.
proposal – The proposal name.
date – The date of the proposal, current date by default.
allow_open_ended – If True, enable to select an unofficial experiment session.
timeout – Set a timeout for the ICAT request.
- Return type:
None- Returns:
The list of datasets (name, path, ICAT identifier, and
DatasetMetadata).
- reschedule_investigation(*args, **kwargs)[source]#
Reschedule an investigation defined by its id.
- Parameters:
investigation_id
- Return type:
None
- send_binary_data(*args, **kw)[source]#
Send an image in base64 format to the proposal or beamline e-logbook.
- Parameters:
data – The binary message content.
mimetype – {‘text/plain’, ‘text/html’}, optional.
beamline – The beamline name of the proposal or beamline e-logbook.
proposal – The proposal name of the e-logbook. Ignored if beamline_only is True.
investigation_id – The investigation identifier in the ICAT database.
beamline_only – if True, the message will be stored in the beamline e-logbook.
payload – Additional payload for the e-logbook message. It can contain tags (list of strings or list of dictionaries), the machine, the software.
- send_binary_file(*args, **kw)[source]#
Send the content of a file as a binary image to the proposal or beamline e-logbook.
- Parameters:
filename – The filename of the image to be sent.
beamline – The beamline name of the proposal or beamline e-logbook.
proposal – The proposal name of the e-logbook. Ignored if beamline_only is True.
beamline_only – if True, the message will be stored in the beamline e-logbook.
payload – Additional payload for the e-logbook message. It can contain tags (list of strings or list of dictionaries), the machine, the software.
- send_message(*args, **kw)[source]#
Send a message to the proposal or beamline e-logbook.
- Parameters:
msg – The message content.
msg_type – {‘comment’, ‘debug’, ‘info’, ‘error’, ‘commandLine’}, optional.
beamline – The beamline name of the proposal or beamline e-logbook.
proposal – The proposal name of the e-logbook. Ignored if beamline_only is True.
investigation_id – The investigation identifier in the ICAT database.
dataset – The specific dataset name to link the message to.
beamline_only – if True, the message will be stored in the beamline e-logbook.
editable – Used with the formatted field, to determine the category of message. Annotation characterizes editable and unformatted messages, while Notification charaterizes non-editable and formatted messages.
formatted – Used with the editable field, to determine the category of message. Annotation characterizes editable and unformatted messages, while Notification charaterizes non-editable and formatted messages.
mimetype – {‘text/plain’, ‘text/html’}, optional.
payload – Additional payload for the message. It can contain tags (list of strings or list of dictionaries), the machine, the software.
- send_text_file(*args, **kw)[source]#
Send the content of a text file as a message to the proposal or beamline e-logbook.
- Parameters:
filename – The filename containing the message to be sent.
beamline – The beamline name of the proposal or beamline e-logbook.
proposal – The proposal name of the e-logbook. Ignored if beamline_only is True.
investigation_id – The investigation identifier in the ICAT database.
beamline_only – if True, the message will be stored in the beamline e-logbook.
payload – Additional payload for the e-logbook message. It can contain tags (list of strings or list of dictionaries), the machine, the software.
- start_investigation(*args, **kw)[source]#
Send a message to ActiveMQ to either synchronize the experiment session from the User Portal in ICAT or to create a test experiment session in ICAT.
- Parameters:
beamline – The beamline name of the proposal.
proposal – The proposal name.
start_datetime – The start date of the experiment session, timezone local time. Current date time by default.
end_datetime – The end date of the experiment session, timezone local time.
- store_dataset(*args, **kw)[source]#
Request icat to store raw dataset.
- Parameters:
str (proposal) – beamline name like id01, id15a, bm18…
str – proposal name like in1169, blc14795, ihma429…
dataset (str) – dataset name.
path (str) – path to the raw dataset to store. Must be a folder.
metadata (dict) – metadata to associate with the dataset. Must contain keys defined by the appropriate application definition, available at https://icat-esrf-definitions.readthedocs.io.
store_filename (str) – xml file with metadata to be stored.
- store_dataset_from_file(*args, **kw)[source]#
Send a message to ActiveMQ to store a dataset and the associated metadata from a xml file stored on the disk.
- Parameters:
store_filename – The XML filename containing all dataset metadata.
- store_processed_data(*args, **kw)[source]#
Request icat to store a processed dataset.
- Parameters:
str (proposal) – beamline name like id01, id15a, bm18…
str – proposal name like in1169, blc14795, ihma429…
dataset (str) – dataset name like sample_XYZ.
path (str) – path to the processed dataset to store. Can be a file or a folder.
metadata (dict) – metadata to associate with the dataset. Must contain keys defined by the appropriate application definition, available at https://icat-esrf-definitions.readthedocs.io.
raw (tuple) – Path(s) to the raw dataset(s). Should point to the ‘bliss dataset’ folder(s). If processing relies on multiple datasets, all corresponding folders must be provided.
store_filename (str) – xml file with metadata to be stored.
- update_archive_restore_status(*args, **kwargs)[source]#
DEPRECATED: This method is deprecated and may be removed in future versions. Update the archiving or restore status of a dataset.
- Parameters:
dataset_id – The ICAT dataset identifier.
type – The type of the status, possible options are {‘archiving’, ‘restoration’}.
level – The level of the status message; possible options are {‘info’, ‘warning’, ‘error’}.
message – The optional status’ message.
- Return type:
None
- update_metadata(*args, **kwargs)[source]#
Update or create datasets metadata.
- Parameters:
proposal – The proposal name.
beamline – The beamline name of the proposal.
dataset_paths – Comma-separated list of the dataset locations.
metadata_name – The name of the metadata to update.
metadata_value – The new value of the metadata.
- Return type:
None