mytardis experiment¶
usage: mytardis experiment [-h] {list,get,create,update} ...
Positional Arguments¶
- command
Possible choices: list, get, create, update
available commands
Sub-commands:¶
list¶
Display a list of experiment records.
mytardis experiment list
[--limit LIMIT] [--offset OFFSET] [--order_by ORDER_BY] [--json]
[--filter FILTER]
EXAMPLE
$ mytardis experiment list
Model: Experiment
Query: http://mytardisdemo.erc.monash.edu.au/api/v1/experiment/?format=json
Total Count: 4
Limit: 20
Offset: 0
+----+-------------------+-----------------------------------+
| ID | Institution | Title |
+====+===================+===================================+
| 20 | Monash University | James Exp 001 |
+----+-------------------+-----------------------------------+
| 13 | Monash University | A's Test Instrument - Test User1 |
+----+-------------------+-----------------------------------+
| 22 | Monash University | James Test Exp 003 |
+----+-------------------+-----------------------------------+
| 14 | Monash University | A's Test Instrument - Test User2 |
+----+-------------------+-----------------------------------+
Named Arguments¶
- --limit
Maximum number of results to return.
- --offset
Skip this many records from the start of the result set.
- --order_by
Order by this field.
Default: “-created_time”
- --json
Display results in JSON format.
Default: False
- --filter
Filter on these fields, e.g. “title=Exp Title”.
get¶
Display a single experiment record.
mytardis experiment get [-h] [--json] experiment_id
EXAMPLE
$ mytardis experiment get 20
+------------------+-------------------+
| Experiment field | Value |
+==================+===================+
| ID | 20 |
+------------------+-------------------+
| Institution | Monash University |
+------------------+-------------------+
| Title | James Exp 001 |
+------------------+-------------------+
| Description | |
+------------------+-------------------+
+------------+------------------------+------------------------+------------+
| Dataset ID | Experiment(s) | Description | Instrument |
+============+========================+========================+============+
| 34 | /api/v1/experiment/20/ | James Test Dataset 001 | None |
+------------+------------------------+------------------------+------------+
| 33 | /api/v1/experiment/20/ | James Test Dataset 003 | None |
+------------+------------------------+------------------------+------------+
| 32 | /api/v1/experiment/20/ | James Test Dataset 002 | None |
+------------+------------------------+------------------------+------------+
| 31 | /api/v1/experiment/20/ | James Test Dataset 001 | None |
+------------+------------------------+------------------------+------------+
Positional Arguments¶
- experiment_id
The experiment ID.
Named Arguments¶
- --metadata
Include metadata.
Default: False
- --json
Display results in JSON format.
Default: False
create¶
Create an experiment record.
mytardis experiment create
[--description DESCRIPTION] [--institution INSTITUTION] [--params PARAMS] title
EXAMPLE
First let's look up an experiment schema we can use to add some
metadata to the new experiment record.
$ mytardis schema list
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
| ID | Name | Namespace | Type | Subtype | Immutable | Hidden |
+====+===========================+===========================================================+===================+=========+===========+========+
... ... ... ... ... ... ...
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
| 12 | Sample Experiment Schema | https://mytardis.org/schemas/sample-experiment-schema | Experiment schema | | False | False |
+----+---------------------------+-----------------------------------------------------------+-------------------+---------+-----------+--------+
"mytardis schema get <schema_id>" displays the parameters
associated with this schema:
$ mytardis schema get 12
+--------------+-------------------------------------------------------+
| Schema field | Value |
+==============+=======================================================+
| ID | 12 |
+--------------+-------------------------------------------------------+
| Name | Sample Experiment Schema |
+--------------+-------------------------------------------------------+
| Namespace | https://mytardis.org/schemas/sample-experiment-schema |
+--------------+-------------------------------------------------------+
| Type | Experiment schema |
+--------------+-------------------------------------------------------+
| Subtype | |
+--------------+-------------------------------------------------------+
| Immutable | False |
+--------------+-------------------------------------------------------+
| Hidden | False |
+--------------+-------------------------------------------------------+
+------------------+-----------------------+-----------------------+-----------+-------+-----------+---------------+-------+---------+-----------------+
| ParameterName ID | Full Name | Name | Data Type | Units | Immutable | Is Searchable | Order | Choices | Comparison Type |
+==================+=======================+=======================+===========+=======+===========+===============+=======+=========+=================+
| 33 | Sample Parameter Name | sample_parameter_name | String | | False | False | 9999 | | Exact value |
+------------------+-----------------------+-----------------------+-----------+-------+-----------+---------------+-------+---------+-----------------+
Now that we know the schema's namespace, the parameter name(s) and
their data type(s), we can create some experiment metadata.
Below we use cat to create the metadata file, but you can use
any text editor.
$ cat << EOF > params.json
[
{
"schema": "https://mytardis.org/schemas/sample-experiment-schema",
"parameters": [
{
"name": "sample_parameter_name",
"value": "Sample Parameter Value"
}
]
}
]
EOF
Now we create the experiment record, using the metadata file
we just created:
$ mytardis experiment create --params params.json "Exp With Params"
+------------------+-------------------+
| Experiment field | Value |
+==================+===================+
| ID | 28 |
+------------------+-------------------+
| Institution | Monash University |
+------------------+-------------------+
| Title | Exp With Params |
+------------------+-------------------+
| Description | |
+------------------+-------------------+
+------------------------+--------------------------+-----------------------+------------------------+-----------------+----------------+---------+
| ExperimentParameter ID | Schema | Parameter Name | String Value | Numerical Value | Datetime Value | Link ID |
+========================+==========================+=======================+========================+=================+================+=========+
| 35 | Sample Experiment Schema | Sample Parameter Name | Sample Parameter Value | | | |
+------------------------+--------------------------+-----------------------+------------------------+-----------------+----------------+---------+
Experiment created successfully.
Positional Arguments¶
- title
The experiment title to create.
Named Arguments¶
- --description
A description of the experiment.
- --institution
The institution of the experiment.
- --params
A JSON file containing experiment parameters.
update¶
Update an experiment record.
mytardis experiment update
[--title TITLE] [--description DESCRIPTION] experiment_id
EXAMPLE
$ mytardis experiment update --title "Renamed Exp" 20
+------------------+-------------------+
| Experiment field | Value |
+==================+===================+
| ID | 20 |
+------------------+-------------------+
| Institution | Monash University |
+------------------+-------------------+
| Title | Renamed Exp |
+------------------+-------------------+
| Description | |
+------------------+-------------------+
Experiment updated successfully.
Positional Arguments¶
- experiment_id
The ID of the experiment to update.
Named Arguments¶
- --title
The new title of the experiment.
- --description
The new description of the experiment.