Skip to content

Experiment

Experiment

Bases: PrimaryBaseNode

Definition

An Experiment node is nested inside a Collection node.

Attributes
attribute type description required
collection Collection collection associated with the experiment True
process List[Process] process nodes associated with this experiment False
computations List[Computation] computation method nodes associated with this experiment False
computation_process List[Computational Process] computation process nodes associated with this experiment False
data List[Data] data nodes associated with this experiment False
funding List[str] funding source for experiment False
citation List[Citation] reference to a book, paper, or scholarly work False
notes str miscellaneous information, or custom data structure False
Sub-objects

An Experiment node can be thought as a folder/bucket that can hold:

Warnings

Experiment names

Experiment names MUST be unique within a Collection


JSON Representation
{
   "name":"my experiment name",
   "node":["Experiment"],
   "uid":"_:886c4deb-2186-4f11-8134-a37111200b83",
   "uuid":"886c4deb-2186-4f11-8134-a37111200b83"
}
Source code in src/cript/nodes/primary_nodes/experiment.py
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
class Experiment(PrimaryBaseNode):
    """
    ## Definition
    An
    [Experiment node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=9)
    is nested inside a [Collection](../collection) node.

    ## Attributes

    | attribute           | type                         | description                                               | required |
    |---------------------|------------------------------|-----------------------------------------------------------|----------|
    | collection          | Collection                   | collection associated with the experiment                 | True     |
    | process             | List[Process]                | process nodes associated with this experiment             | False    |
    | computations        | List[Computation]            | computation method nodes associated with this experiment  | False    |
    | computation_process | List[Computational  Process] | computation process nodes associated with this experiment | False    |
    | data                | List[Data]                   | data nodes associated with this experiment                | False    |
    | funding             | List[str]                    | funding source for experiment                             | False    |
    | citation            | List[Citation]               | reference to a book, paper, or scholarly work             | False    |
    | notes               | str                          | miscellaneous information, or custom data structure       | False    |


    ## Sub-objects
    An
    [Experiment node](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=9)
    can be thought as a folder/bucket that can hold:

    * [Process](../process)
    * [Computations](../computation)
    * [Computation_Process](../computation_process)
    * [Data](../data)
    * [Funding](./#cript.nodes.primary_nodes.experiment.Experiment.funding)
    * [Citation](../../subobjects/citation)


    Warnings
    --------
    !!! warning "Experiment names"
        Experiment names **MUST** be unique within a [Collection](../collection)

    ---

    ## JSON Representation
    ```json
    {
       "name":"my experiment name",
       "node":["Experiment"],
       "uid":"_:886c4deb-2186-4f11-8134-a37111200b83",
       "uuid":"886c4deb-2186-4f11-8134-a37111200b83"
    }
    ```

    """

    @dataclass(frozen=True)
    class JsonAttributes(PrimaryBaseNode.JsonAttributes):
        """
        all Collection attributes
        """

        process: List[Union[Any, UIDProxy]] = field(default_factory=list)
        computation: List[Union[Any, UIDProxy]] = field(default_factory=list)
        computation_process: List[Union[Any, UIDProxy]] = field(default_factory=list)
        data: List[Union[Any, UIDProxy]] = field(default_factory=list)
        funding: List[str] = field(default_factory=list)
        citation: List[Union[Any, UIDProxy]] = field(default_factory=list)

    _json_attrs: JsonAttributes = JsonAttributes()

    @beartype
    def __init__(
        self,
        name: str,
        process: Optional[List[Union[Any, UIDProxy]]] = None,
        computation: Optional[List[Union[Any, UIDProxy]]] = None,
        computation_process: Optional[List[Union[Any, UIDProxy]]] = None,
        data: Optional[List[Union[Any, UIDProxy]]] = None,
        funding: Optional[List[str]] = None,
        citation: Optional[List[Union[Any, UIDProxy]]] = None,
        notes: str = "",
        **kwargs
    ):
        """
        create an Experiment node

        Examples
        --------
        >>> import cript
        >>> my_experiment = cript.Experiment(name="my experiment name")

        Parameters
        ----------
        name: str
            name of Experiment
        process: List[Process]
            list of Process nodes for this Experiment
        computation: List[Computation]
            list of computation nodes for this Experiment
        computation_process: List[ComputationalProcess]
            list of computational_process nodes for this Experiment
        data: List[Data]
            list of data nodes for this experiment
        funding: List[str]
            list of the funders names for this Experiment
        citation: List[Citation]
            list of Citation nodes for this experiment
        notes: str default=""
            notes for the experiment node

        Returns
        -------
        None
            Instantiate an Experiment node
        """

        if process is None:
            process = []
        if computation is None:
            computation = []
        if computation_process is None:
            computation_process = []
        if data is None:
            data = []
        if funding is None:
            funding = []
        if citation is None:
            citation = []

        super().__init__(name=name, notes=notes, **kwargs)

        new_json_attrs = replace(
            self._json_attrs,
            name=name,
            process=process,
            computation=computation,
            computation_process=computation_process,
            data=data,
            funding=funding,
            citation=citation,
            notes=notes,
        )

        self._update_json_attrs_if_valid(new_json_attrs)

    @property
    @beartype
    def process(self) -> List[Any]:
        """
        List of process for experiment

        Examples
        --------
        >>> import cript
        >>> my_experiment = cript.Experiment(name="my experiment name")
        >>> my_process = cript.Process(name="my process name", type="affinity_pure")
        >>> my_experiment.process = [my_process]

        Returns
        -------
        List[Process]
            List of process that were performed in this experiment
        """
        return self._json_attrs.process.copy()

    @process.setter
    @beartype
    def process(self, new_process_list: List[Any]) -> None:
        """
        set the list of process for this experiment

        Parameters
        ----------
        new_process_list: List[Process]
            new process list to replace the current process list

        Returns
        -------
        None
        """
        new_attrs = replace(self._json_attrs, process=new_process_list)
        self._update_json_attrs_if_valid(new_attrs)

    @property
    @beartype
    def computation(self) -> List[Any]:
        """
        List of the [computations](../computation) in this experiment

        Examples
        --------
        >>> import cript
        >>> my_experiment = cript.Experiment(name="my experiment name")
        >>> my_computation = cript.Computation(name="my computation name", type="analysis")
        >>> my_experiment.computation = [my_computation]

        Returns
        -------
        List[Computation]
            List of [computations](../computation) for this experiment
        """
        return self._json_attrs.computation.copy()

    @computation.setter
    @beartype
    def computation(self, new_computation_list: List[Any]) -> None:
        """
        set the list of computations for this experiment

        Parameters
        ----------
        new_computation_list: List[Computation]
            new list of computations to replace the current list of experiments

        Returns
        -------
        None
        """
        new_attrs = replace(self._json_attrs, computation=new_computation_list)
        self._update_json_attrs_if_valid(new_attrs)

    @property
    @beartype
    def computation_process(self) -> List[Any]:
        """
        List of [computation_process](../computation_process) for this experiment

        Examples
        --------
        >>> import cript
        >>> my_experiment = cript.Experiment(name="my experiment name")
        >>> my_file = cript.File(
        ...     name="my file node",
        ...     source="https://criptapp.org",
        ...     type="calibration",
        ...     extension=".csv",
        ...     data_dictionary="my file's data dictionary",
        ... )
        >>> my_data = cript.Data(name="my data name", type="afm_amp", file=[my_file])
        >>> my_material = cript.Material(
        ...     name="my material name", bigsmiles = "123456"
        ... )
        >>> my_quantity = cript.Quantity(
        ... key="mass", value=11.2, unit="kg", uncertainty=0.2, uncertainty_type="stdev"
        ... )
        >>> my_ingredient = cript.Ingredient(
        ... material=my_material, quantity=[my_quantity], keyword=["catalyst"]
        ... )
        >>> my_computation_process = cript.ComputationProcess(
        ...     name="my computational process name",
        ...     type="cross_linking",         # must come from CRIPT Controlled Vocabulary
        ...     input_data=[my_data],         # input data is another data node
        ...     ingredient=[my_ingredient],  # output data is another data node
        ... )
        >>> my_experiment.computation_process = [my_computation_process]

        Returns
        -------
        List[ComputationalProcess]
            computational process that were performed in this experiment
        """
        return self._json_attrs.computation_process.copy()

    @computation_process.setter
    @beartype
    def computation_process(self, new_computation_process_list: List[Any]) -> None:
        """
        set the list of computation_process for this experiment

        Parameters
        ----------
        new_computation_process_list: List[ComputationalProcess]
            new list of computations to replace the current for the experiment

        Returns
        -------
        None
        """
        new_attrs = replace(self._json_attrs, computation_process=new_computation_process_list)
        self._update_json_attrs_if_valid(new_attrs)

    @property
    @beartype
    def data(self) -> List[Any]:
        """
        List of [data nodes](../data) for this experiment

        Examples
        --------
        >>> import cript
        >>> my_experiment = cript.Experiment(name="my experiment name")
        >>> my_file = cript.File(
        ...    name="my file node name",
        ...    source="https://criptapp.org",
        ...    type="calibration",
        ...    extension=".csv",
        ...    data_dictionary="my file's data dictionary",
        ... )
        >>> my_data = cript.Data(name="my data name", type="afm_amp", file=[my_file])
        >>> my_experiment.data = [my_data]

        Returns
        -------
        List[Data]
            list of [data nodes](../data) that belong to this experiment
        """
        return self._json_attrs.data.copy()

    @data.setter
    @beartype
    def data(self, new_data_list: List[Any]) -> None:
        """
        set the list of data for this experiment

        Parameters
        ----------
        new_data_list: List[Data]
            new list of data to replace the current list for this experiment

        Returns
        -------
        None
        """
        new_attrs = replace(self._json_attrs, data=new_data_list)
        self._update_json_attrs_if_valid(new_attrs)

    @property
    @beartype
    def funding(self) -> List[str]:
        """
        List of strings of all the funders for this experiment

        Examples
        --------
        >>> import cript
        >>> my_experiment = cript.Experiment(name="my experiment name")
        >>> my_experiment.funding = ["National Science Foundation", "IRIS", "NIST"]

        Returns
        -------
        List[str]
            List of funders for this experiment
        """
        return self._json_attrs.funding.copy()

    @funding.setter
    @beartype
    def funding(self, new_funding_list: List[str]) -> None:
        """
        set the list of funders for this experiment

        Parameters
        ----------
        new_funding_list: List[str]
            replace the current list of funders

        Returns
        -------
        None
        """
        new_attrs = replace(self._json_attrs, funding=new_funding_list)
        self._update_json_attrs_if_valid(new_attrs)

    @property
    @beartype
    def citation(self) -> List[Any]:
        """
        List of [citation](../../subobjects/citation) for this experiment

        Examples
        --------
        >>> import cript
        >>> my_experiment = cript.Experiment(name="my experiment name")
        >>> my_reference = cript.Reference(
        ...     type="journal_article",
        ...     title="title",
        ...     author=["Ludwig Schneider", "Marcus Müller"],
        ...     journal="Computer Physics Communications",
        ...     publisher="Elsevier",
        ...     year=2019,
        ...     pages=[463, 476],
        ...     doi="10.1016/j.cpc.2018.08.011",
        ...     issn="0010-4655",
        ...     website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
        ... )
        >>> my_citation = cript.Citation(type="derived_from", reference=my_reference)
        >>> my_experiment.citation = [my_citation]

        Returns
        -------
        List[Citation]
            list of citations of scholarly work that was used in this experiment
        """
        return self._json_attrs.citation.copy()

    @citation.setter
    @beartype
    def citation(self, new_citation_list: List[Any]) -> None:
        """
        set the list of citations for this experiment

        Parameters
        ----------
        new_citations_list: List[Citation]
            replace the list of citations for this experiment with a new list of citations

        Returns
        -------
        None
        """
        new_attrs = replace(self._json_attrs, citation=new_citation_list)
        self._update_json_attrs_if_valid(new_attrs)

citation: List[Any] property writable

List of citation for this experiment

Examples:

>>> import cript
>>> my_experiment = cript.Experiment(name="my experiment name")
>>> my_reference = cript.Reference(
...     type="journal_article",
...     title="title",
...     author=["Ludwig Schneider", "Marcus Müller"],
...     journal="Computer Physics Communications",
...     publisher="Elsevier",
...     year=2019,
...     pages=[463, 476],
...     doi="10.1016/j.cpc.2018.08.011",
...     issn="0010-4655",
...     website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
... )
>>> my_citation = cript.Citation(type="derived_from", reference=my_reference)
>>> my_experiment.citation = [my_citation]

Returns:

Type Description
List[Citation]

list of citations of scholarly work that was used in this experiment

computation: List[Any] property writable

List of the computations in this experiment

Examples:

>>> import cript
>>> my_experiment = cript.Experiment(name="my experiment name")
>>> my_computation = cript.Computation(name="my computation name", type="analysis")
>>> my_experiment.computation = [my_computation]

Returns:

Type Description
List[Computation]

List of computations for this experiment

computation_process: List[Any] property writable

List of computation_process for this experiment

Examples:

>>> import cript
>>> my_experiment = cript.Experiment(name="my experiment name")
>>> my_file = cript.File(
...     name="my file node",
...     source="https://criptapp.org",
...     type="calibration",
...     extension=".csv",
...     data_dictionary="my file's data dictionary",
... )
>>> my_data = cript.Data(name="my data name", type="afm_amp", file=[my_file])
>>> my_material = cript.Material(
...     name="my material name", bigsmiles = "123456"
... )
>>> my_quantity = cript.Quantity(
... key="mass", value=11.2, unit="kg", uncertainty=0.2, uncertainty_type="stdev"
... )
>>> my_ingredient = cript.Ingredient(
... material=my_material, quantity=[my_quantity], keyword=["catalyst"]
... )
>>> my_computation_process = cript.ComputationProcess(
...     name="my computational process name",
...     type="cross_linking",         # must come from CRIPT Controlled Vocabulary
...     input_data=[my_data],         # input data is another data node
...     ingredient=[my_ingredient],  # output data is another data node
... )
>>> my_experiment.computation_process = [my_computation_process]

Returns:

Type Description
List[ComputationalProcess]

computational process that were performed in this experiment

data: List[Any] property writable

List of data nodes for this experiment

Examples:

>>> import cript
>>> my_experiment = cript.Experiment(name="my experiment name")
>>> my_file = cript.File(
...    name="my file node name",
...    source="https://criptapp.org",
...    type="calibration",
...    extension=".csv",
...    data_dictionary="my file's data dictionary",
... )
>>> my_data = cript.Data(name="my data name", type="afm_amp", file=[my_file])
>>> my_experiment.data = [my_data]

Returns:

Type Description
List[Data]

list of data nodes that belong to this experiment

funding: List[str] property writable

List of strings of all the funders for this experiment

Examples:

>>> import cript
>>> my_experiment = cript.Experiment(name="my experiment name")
>>> my_experiment.funding = ["National Science Foundation", "IRIS", "NIST"]

Returns:

Type Description
List[str]

List of funders for this experiment

process: List[Any] property writable

List of process for experiment

Examples:

>>> import cript
>>> my_experiment = cript.Experiment(name="my experiment name")
>>> my_process = cript.Process(name="my process name", type="affinity_pure")
>>> my_experiment.process = [my_process]

Returns:

Type Description
List[Process]

List of process that were performed in this experiment

JsonAttributes dataclass

Bases: JsonAttributes

all Collection attributes

Source code in src/cript/nodes/primary_nodes/experiment.py
@dataclass(frozen=True)
class JsonAttributes(PrimaryBaseNode.JsonAttributes):
    """
    all Collection attributes
    """

    process: List[Union[Any, UIDProxy]] = field(default_factory=list)
    computation: List[Union[Any, UIDProxy]] = field(default_factory=list)
    computation_process: List[Union[Any, UIDProxy]] = field(default_factory=list)
    data: List[Union[Any, UIDProxy]] = field(default_factory=list)
    funding: List[str] = field(default_factory=list)
    citation: List[Union[Any, UIDProxy]] = field(default_factory=list)

__init__(name, process=None, computation=None, computation_process=None, data=None, funding=None, citation=None, notes='', **kwargs)

create an Experiment node

Examples:

>>> import cript
>>> my_experiment = cript.Experiment(name="my experiment name")

Parameters:

Name Type Description Default
name str

name of Experiment

required
process Optional[List[Union[Any, UIDProxy]]]

list of Process nodes for this Experiment

None
computation Optional[List[Union[Any, UIDProxy]]]

list of computation nodes for this Experiment

None
computation_process Optional[List[Union[Any, UIDProxy]]]

list of computational_process nodes for this Experiment

None
data Optional[List[Union[Any, UIDProxy]]]

list of data nodes for this experiment

None
funding Optional[List[str]]

list of the funders names for this Experiment

None
citation Optional[List[Union[Any, UIDProxy]]]

list of Citation nodes for this experiment

None
notes str

notes for the experiment node

''

Returns:

Type Description
None

Instantiate an Experiment node

Source code in src/cript/nodes/primary_nodes/experiment.py
@beartype
def __init__(
    self,
    name: str,
    process: Optional[List[Union[Any, UIDProxy]]] = None,
    computation: Optional[List[Union[Any, UIDProxy]]] = None,
    computation_process: Optional[List[Union[Any, UIDProxy]]] = None,
    data: Optional[List[Union[Any, UIDProxy]]] = None,
    funding: Optional[List[str]] = None,
    citation: Optional[List[Union[Any, UIDProxy]]] = None,
    notes: str = "",
    **kwargs
):
    """
    create an Experiment node

    Examples
    --------
    >>> import cript
    >>> my_experiment = cript.Experiment(name="my experiment name")

    Parameters
    ----------
    name: str
        name of Experiment
    process: List[Process]
        list of Process nodes for this Experiment
    computation: List[Computation]
        list of computation nodes for this Experiment
    computation_process: List[ComputationalProcess]
        list of computational_process nodes for this Experiment
    data: List[Data]
        list of data nodes for this experiment
    funding: List[str]
        list of the funders names for this Experiment
    citation: List[Citation]
        list of Citation nodes for this experiment
    notes: str default=""
        notes for the experiment node

    Returns
    -------
    None
        Instantiate an Experiment node
    """

    if process is None:
        process = []
    if computation is None:
        computation = []
    if computation_process is None:
        computation_process = []
    if data is None:
        data = []
    if funding is None:
        funding = []
    if citation is None:
        citation = []

    super().__init__(name=name, notes=notes, **kwargs)

    new_json_attrs = replace(
        self._json_attrs,
        name=name,
        process=process,
        computation=computation,
        computation_process=computation_process,
        data=data,
        funding=funding,
        citation=citation,
        notes=notes,
    )

    self._update_json_attrs_if_valid(new_json_attrs)