Skip to content

Condition

Condition

Bases: UUIDBaseNode

Definition

A Condition sub-object is the conditions under which the experiment was conducted. Some examples include temperature, mixing_rate, stirring, time_duration.


Can Be Added To:
Primary Nodes
Subobjects

Attributes
attribute type example description required vocab
key str temp type of condition True True
type str min type of value stored, 'value' is just the number, 'min', 'max', 'avg', etc. for series True True
descriptor str upper temperature probe freeform description for condition
value Number 1.23 value or quantity True
unit str gram unit for value
uncertainty Number 0.1 uncertainty of value
uncertainty_type str std type of uncertainty True
set_id int 0 ID of set (used to link measurements in as series)
measurement _id int 0 ID for a single measurement (used to link multiple condition at a single instance)
data List[Data] detailed data associated with the condition
JSON Representation
{
    "node": ["Condition"],
    "key": "temperature",
    "type": "value",
    "descriptor": "room temperature of lab",
    "value": 22,
    "unit": "C",
    "uncertainty": 5,
    "uncertainty_type": "stdev",
    "set_id": 0,
    "measurement_id": 2,
    "data": [{
        "node":["Data"],
        "name":"my data name",
        "type":"afm_amp",
        "file":[
            {
                "node":["File"],
                "type":"calibration",
                "source":"https://criptapp.org",
                "extension":".csv",
                "data_dictionary":"my file's data dictionary"
            }
        ]
    }],
}
Source code in src/cript/nodes/subobjects/condition.py
 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
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
class Condition(UUIDBaseNode):
    """
    ## Definition

    A [Condition](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=21) sub-object
    is the conditions under which the experiment was conducted.
    Some examples include temperature, mixing_rate, stirring, time_duration.

    ----

    ## Can Be Added To:
    ### Primary Nodes
    * [Process](../../primary_nodes/process)
    * [Computation_Process](../../primary_nodes/computation_process)

    ### Subobjects
    * [Property](../property)
    * [Equipment](../equipment)

    ---

    ## Attributes

    | attribute        | type   | example                 | description                                                                            | required | vocab |
    |------------------|--------|-------------------------|----------------------------------------------------------------------------------------|----------|-------|
    | key              | str    | temp                    | type of condition                                                                      | True     | True  |
    | type             | str    | min                     | type of value stored, 'value' is just the number, 'min', 'max', 'avg', etc. for series | True     | True  |
    | descriptor       | str    | upper temperature probe | freeform description for condition                                                     |          |       |
    | value            | Number | 1.23                    | value or quantity                                                                      | True     |       |
    | unit             | str    | gram                    | unit for value                                                                         |          |       |
    | uncertainty      | Number | 0.1                     | uncertainty of value                                                                   |          |       |
    | uncertainty_type | str    | std                     | type of uncertainty                                                                    |          | True  |
    | set_id           | int    | 0                       | ID of set (used to link measurements in as series)                                     |          |       |
    | measurement _id  | int    | 0                       | ID for a single measurement (used to link multiple condition at a single instance)     |          |       |
    | data             | List[Data] |                         | detailed data associated with the condition                                            |          |       |

    ## JSON Representation
    ```json
    {
        "node": ["Condition"],
        "key": "temperature",
        "type": "value",
        "descriptor": "room temperature of lab",
        "value": 22,
        "unit": "C",
        "uncertainty": 5,
        "uncertainty_type": "stdev",
        "set_id": 0,
        "measurement_id": 2,
        "data": [{
            "node":["Data"],
            "name":"my data name",
            "type":"afm_amp",
            "file":[
                {
                    "node":["File"],
                    "type":"calibration",
                    "source":"https://criptapp.org",
                    "extension":".csv",
                    "data_dictionary":"my file's data dictionary"
                }
            ]
        }],
    }
    ```
    """

    @dataclass(frozen=True)
    class JsonAttributes(UUIDBaseNode.JsonAttributes):
        key: str = ""
        type: str = ""
        descriptor: str = ""
        value: Optional[Union[Number, str]] = None
        unit: str = ""
        uncertainty: Optional[Union[Number, str]] = None
        uncertainty_type: str = ""
        set_id: Optional[int] = None
        measurement_id: Optional[int] = None
        data: List[Union[Data, UIDProxy]] = field(default_factory=list)

    _json_attrs: JsonAttributes = JsonAttributes()

    @beartype
    def __init__(
        self,
        key: str,
        type: str,
        value: Union[Number, str],
        unit: str = "",
        descriptor: str = "",
        uncertainty: Optional[Union[Number, str]] = None,
        uncertainty_type: str = "",
        set_id: Optional[int] = None,
        measurement_id: Optional[int] = None,
        data: Optional[List[Union[Data, UIDProxy]]] = None,
        **kwargs
    ):
        """
        create Condition sub-object

        Parameters
        ----------
        key : str
            type of condition
        type : str
            type of value stored
        value : Number
            value or quantity
        unit : str, optional
            unit for value, by default ""
        descriptor : str, optional
            freeform description for condition, by default ""
        uncertainty : Union[Number, None], optional
           uncertainty of value, by default None
        uncertainty_type : str, optional
            type of uncertainty, by default ""
        set_id : Union[int, None], optional
            ID of set (used to link measurements in as series), by default None
        measurement_id : Union[int, None], optional
            ID for a single measurement (used to link multiple condition at a single instance), by default None
        data : List[Data], optional
            detailed data associated with the condition, by default None


        Examples
        --------
        >>> import cript
        >>> my_condition = cript.Condition(
        ...     key="temperature",
        ...     type="value",
        ...     value=22,
        ...     unit="C",
        ... )

        Returns
        -------
        None
        """
        super().__init__(**kwargs)

        if data is None:
            data = []

        new_json_attrs = replace(
            self._json_attrs,
            key=key,
            type=type,
            value=value,
            descriptor=descriptor,
            unit=unit,
            uncertainty=uncertainty,
            uncertainty_type=uncertainty_type,
            set_id=set_id,
            measurement_id=measurement_id,
            data=data,
        )
        self._update_json_attrs_if_valid(new_json_attrs)

    @property
    @beartype
    def key(self) -> str:
        """
        type of condition

        > Condition key must come from [CRIPT Controlled Vocabulary](https://app.criptapp.org/vocab/condition_key)

        Examples
        --------
        >>> import cript
        >>> my_condition = cript.Condition(
        ...     key="temperature",
        ...     type="value",
        ...     value=22,
        ...     unit="C",
        ... )
        >>> my_condition.key = "energy_threshold"

        Returns
        -------
        condition key: str
            type of condition
        """
        return self._json_attrs.key

    @key.setter
    @beartype
    def key(self, new_key: str) -> None:
        """
        set this Condition sub-object key

        Parameters
        ----------
        new_key : str
            type of condition

        Returns
        --------
        None
        """
        new_attrs = replace(self._json_attrs, key=new_key)
        self._update_json_attrs_if_valid(new_attrs)

    @property
    @beartype
    def type(self) -> str:
        """
        description for the value stored for this Condition node

        Examples
        --------
        >>> import cript
        >>> my_condition = cript.Condition(
        ...     key="temperature",
        ...     type="value",
        ...     value=22,
        ...     unit="C",
        ... )
        >>> my_condition.type = "min"

        Returns
        -------
        condition type: str
            description for the value
        """
        return self._json_attrs.type

    @type.setter
    @beartype
    def type(self, new_type: str) -> None:
        """
        set the type attribute for this Condition node

        Parameters
        ----------
        new_type : str
            new description of the Condition value

        Returns
        -------
        None
        """
        new_attrs = replace(self._json_attrs, type=new_type)
        self._update_json_attrs_if_valid(new_attrs)

    @property
    @beartype
    def descriptor(self) -> str:
        """
        freeform description for Condition

        Examples
        --------
        >>> import cript
        >>> my_condition = cript.Condition(
        ...     key="temperature",
        ...     type="value",
        ...     value=22,
        ...     unit="C",
        ... )
        >>> my_condition.descriptor = "my condition description"

        Returns
        -------
        description: str
            description of this Condition sub-object
        """
        return self._json_attrs.descriptor

    @descriptor.setter
    @beartype
    def descriptor(self, new_descriptor: str) -> None:
        """
        set the description of this Condition sub-object

        Parameters
        ----------
        new_descriptor : str
            new description describing the Condition subobject

        Returns
        -------
        None
        """
        new_attrs = replace(self._json_attrs, descriptor=new_descriptor)
        self._update_json_attrs_if_valid(new_attrs)

    @property
    @beartype
    def value(self) -> Optional[Union[Number, str]]:
        """
        value or quantity

        Returns
        -------
        Union[Number, None]
            new value or quantity
        """
        return self._json_attrs.value

    def set_value(self, new_value: Union[Number, str], new_unit: str) -> None:
        """
        set the value for this Condition subobject

        Parameters
        ----------
        new_value : Number
            new value
        new_unit : str
            units for the new value

        Examples
        --------
        >>> import cript
        >>> my_condition = cript.Condition(
        ...     key="temperature",
        ...     type="value",
        ...     value=22,
        ...     unit="C",
        ... )
        >>> my_condition.set_value(new_value=1, new_unit="gram")

        Returns
        -------
        None
        """
        new_attrs = replace(self._json_attrs, value=new_value, unit=new_unit)
        self._update_json_attrs_if_valid(new_attrs)

    @property
    @beartype
    def unit(self) -> str:
        """
        set units for this Condition subobject

        Returns
        -------
        unit: str
            units
        """
        return self._json_attrs.unit

    @property
    @beartype
    def uncertainty(self) -> Optional[Union[Number, str]]:
        """
        set uncertainty value for this Condition subobject

        Returns
        -------
        uncertainty: Union[Number, None]
            uncertainty
        """
        return self._json_attrs.uncertainty

    @beartype
    def set_uncertainty(self, new_uncertainty: Union[Number, str, None], new_uncertainty_type: str) -> None:
        """
        set uncertainty and uncertainty type

        Parameters
        ----------
        new_uncertainty : Number
            new uncertainty value
        new_uncertainty_type : str
            new uncertainty type

        Examples
        --------
        >>> import cript
        >>> my_condition = cript.Condition(
        ...     key="temperature",
        ...     type="value",
        ...     value=22,
        ...     unit="C",
        ... )
        >>> my_condition.set_uncertainty(new_uncertainty=0.2, new_uncertainty_type="stdev")

        Returns
        -------
        None
        """
        new_attrs = replace(self._json_attrs, uncertainty=new_uncertainty, uncertainty_type=new_uncertainty_type)
        self._update_json_attrs_if_valid(new_attrs)

    @property
    @beartype
    def uncertainty_type(self) -> str:
        """
        Uncertainty type for the uncertainty value

        [Uncertainty type](https://app.criptapp.org/vocab/uncertainty_type) must come from CRIPT controlled vocabulary

        Returns
        -------
        uncertainty_type: str
            uncertainty type
        """
        return self._json_attrs.uncertainty_type

    @property
    @beartype
    def set_id(self) -> Union[int, None]:
        """
        ID of set (used to link measurements in as series)

        Examples
        --------
        >>> import cript
        >>> my_condition = cript.Condition(
        ...     key="temperature",
        ...     type="value",
        ...     value=22,
        ...     unit="C",
        ... )
        >>> my_condition.set_id = 0

        Returns
        -------
        set_id: Union[int, None]
            ID of set
        """
        return self._json_attrs.set_id

    @set_id.setter
    @beartype
    def set_id(self, new_set_id: Union[int, None]) -> None:
        """
         set this Condition subobjects set_id

        Parameters
        ----------
        new_set_id : Union[int, None]
            ID of set

        Returns
        -------
        None
        """
        new_attrs = replace(self._json_attrs, set_id=new_set_id)
        self._update_json_attrs_if_valid(new_attrs)

    @property
    @beartype
    def measurement_id(self) -> Union[int, None]:
        """
        ID for a single measurement (used to link multiple condition at a single instance)

        Examples
        --------
        >>> import cript
        >>> my_condition = cript.Condition(
        ...     key="temperature",
        ...     type="value",
        ...     value=22,
        ...     unit="C",
        ... )
        >>> my_condition.measurement_id = 0

        Returns
        -------
        measurement_id: Union[int, None]
            ID for a single measurement
        """
        return self._json_attrs.measurement_id

    @measurement_id.setter
    @beartype
    def measurement_id(self, new_measurement_id: Union[int, None]) -> None:
        """
        set the set_id for this Condition subobject

        Examples
        --------
        >>> import cript
        >>> my_condition = cript.Condition(
        ...     key="temperature",
        ...     type="value",
        ...     value=22,
        ...     unit="C",
        ... )
        >>> my_condition.measurement_id = 1

        Parameters
        ----------
        new_measurement_id : Union[int, None]
            ID for a single measurement

        Returns
        -------
        None
        """
        new_attrs = replace(self._json_attrs, measurement_id=new_measurement_id)
        self._update_json_attrs_if_valid(new_attrs)

    @property
    @beartype
    def data(self) -> List[Union[Data, UIDProxy]]:
        """
        detailed data associated with the condition

        Examples
        --------
        >>> import cript
        >>> my_condition = cript.Condition(
        ...     key="temperature",
        ...     type="value",
        ...     value=22,
        ...     unit="C",
        ... )
        >>> my_file = cript.File(
        ...     name="my file node name",
        ...     source="https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf",
        ...     type="calibration",
        ...     extension=".pdf",
        ... )
        >>> my_data = cript.Data(
        ...     name="my data node name",
        ...     type="afm_amp",
        ...     file=[my_file],
        ... )
        >>> my_condition.data = [my_data]

        Returns
        -------
        Condition: Union[Data, None]
            detailed data associated with the condition
        """
        return self._json_attrs.data.copy()

    @data.setter
    @beartype
    def data(self, new_data: List[Union[Data, UIDProxy]]) -> None:
        """
        set the data node for this Condition Subobject

        Parameters
        ----------
        new_data : List[Data]
            new Data node

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

__init__(key, type, value, unit='', descriptor='', uncertainty=None, uncertainty_type='', set_id=None, measurement_id=None, data=None, **kwargs)

create Condition sub-object

Parameters:

Name Type Description Default
key str

type of condition

required
type str

type of value stored

required
value Number

value or quantity

required
unit str

unit for value, by default ""

''
descriptor str

freeform description for condition, by default ""

''
uncertainty Union[Number, None]

uncertainty of value, by default None

None
uncertainty_type str

type of uncertainty, by default ""

''
set_id Union[int, None]

ID of set (used to link measurements in as series), by default None

None
measurement_id Union[int, None]

ID for a single measurement (used to link multiple condition at a single instance), by default None

None
data List[Data]

detailed data associated with the condition, by default None

None

Examples:

>>> import cript
>>> my_condition = cript.Condition(
...     key="temperature",
...     type="value",
...     value=22,
...     unit="C",
... )

Returns:

Type Description
None
Source code in src/cript/nodes/subobjects/condition.py
@beartype
def __init__(
    self,
    key: str,
    type: str,
    value: Union[Number, str],
    unit: str = "",
    descriptor: str = "",
    uncertainty: Optional[Union[Number, str]] = None,
    uncertainty_type: str = "",
    set_id: Optional[int] = None,
    measurement_id: Optional[int] = None,
    data: Optional[List[Union[Data, UIDProxy]]] = None,
    **kwargs
):
    """
    create Condition sub-object

    Parameters
    ----------
    key : str
        type of condition
    type : str
        type of value stored
    value : Number
        value or quantity
    unit : str, optional
        unit for value, by default ""
    descriptor : str, optional
        freeform description for condition, by default ""
    uncertainty : Union[Number, None], optional
       uncertainty of value, by default None
    uncertainty_type : str, optional
        type of uncertainty, by default ""
    set_id : Union[int, None], optional
        ID of set (used to link measurements in as series), by default None
    measurement_id : Union[int, None], optional
        ID for a single measurement (used to link multiple condition at a single instance), by default None
    data : List[Data], optional
        detailed data associated with the condition, by default None


    Examples
    --------
    >>> import cript
    >>> my_condition = cript.Condition(
    ...     key="temperature",
    ...     type="value",
    ...     value=22,
    ...     unit="C",
    ... )

    Returns
    -------
    None
    """
    super().__init__(**kwargs)

    if data is None:
        data = []

    new_json_attrs = replace(
        self._json_attrs,
        key=key,
        type=type,
        value=value,
        descriptor=descriptor,
        unit=unit,
        uncertainty=uncertainty,
        uncertainty_type=uncertainty_type,
        set_id=set_id,
        measurement_id=measurement_id,
        data=data,
    )
    self._update_json_attrs_if_valid(new_json_attrs)

data(new_data)

set the data node for this Condition Subobject

Parameters:

Name Type Description Default
new_data List[Data]

new Data node

required

Returns:

Type Description
None
Source code in src/cript/nodes/subobjects/condition.py
@data.setter
@beartype
def data(self, new_data: List[Union[Data, UIDProxy]]) -> None:
    """
    set the data node for this Condition Subobject

    Parameters
    ----------
    new_data : List[Data]
        new Data node

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

descriptor(new_descriptor)

set the description of this Condition sub-object

Parameters:

Name Type Description Default
new_descriptor str

new description describing the Condition subobject

required

Returns:

Type Description
None
Source code in src/cript/nodes/subobjects/condition.py
@descriptor.setter
@beartype
def descriptor(self, new_descriptor: str) -> None:
    """
    set the description of this Condition sub-object

    Parameters
    ----------
    new_descriptor : str
        new description describing the Condition subobject

    Returns
    -------
    None
    """
    new_attrs = replace(self._json_attrs, descriptor=new_descriptor)
    self._update_json_attrs_if_valid(new_attrs)

key(new_key)

set this Condition sub-object key

Parameters:

Name Type Description Default
new_key str

type of condition

required

Returns:

Type Description
None
Source code in src/cript/nodes/subobjects/condition.py
@key.setter
@beartype
def key(self, new_key: str) -> None:
    """
    set this Condition sub-object key

    Parameters
    ----------
    new_key : str
        type of condition

    Returns
    --------
    None
    """
    new_attrs = replace(self._json_attrs, key=new_key)
    self._update_json_attrs_if_valid(new_attrs)

measurement_id(new_measurement_id)

set the set_id for this Condition subobject

Examples:

>>> import cript
>>> my_condition = cript.Condition(
...     key="temperature",
...     type="value",
...     value=22,
...     unit="C",
... )
>>> my_condition.measurement_id = 1

Parameters:

Name Type Description Default
new_measurement_id Union[int, None]

ID for a single measurement

required

Returns:

Type Description
None
Source code in src/cript/nodes/subobjects/condition.py
@measurement_id.setter
@beartype
def measurement_id(self, new_measurement_id: Union[int, None]) -> None:
    """
    set the set_id for this Condition subobject

    Examples
    --------
    >>> import cript
    >>> my_condition = cript.Condition(
    ...     key="temperature",
    ...     type="value",
    ...     value=22,
    ...     unit="C",
    ... )
    >>> my_condition.measurement_id = 1

    Parameters
    ----------
    new_measurement_id : Union[int, None]
        ID for a single measurement

    Returns
    -------
    None
    """
    new_attrs = replace(self._json_attrs, measurement_id=new_measurement_id)
    self._update_json_attrs_if_valid(new_attrs)

set_id(new_set_id)

set this Condition subobjects set_id

Parameters:

Name Type Description Default
new_set_id Union[int, None]

ID of set

required

Returns:

Type Description
None
Source code in src/cript/nodes/subobjects/condition.py
@set_id.setter
@beartype
def set_id(self, new_set_id: Union[int, None]) -> None:
    """
     set this Condition subobjects set_id

    Parameters
    ----------
    new_set_id : Union[int, None]
        ID of set

    Returns
    -------
    None
    """
    new_attrs = replace(self._json_attrs, set_id=new_set_id)
    self._update_json_attrs_if_valid(new_attrs)

set_uncertainty(new_uncertainty, new_uncertainty_type)

set uncertainty and uncertainty type

Parameters:

Name Type Description Default
new_uncertainty Number

new uncertainty value

required
new_uncertainty_type str

new uncertainty type

required

Examples:

>>> import cript
>>> my_condition = cript.Condition(
...     key="temperature",
...     type="value",
...     value=22,
...     unit="C",
... )
>>> my_condition.set_uncertainty(new_uncertainty=0.2, new_uncertainty_type="stdev")

Returns:

Type Description
None
Source code in src/cript/nodes/subobjects/condition.py
@beartype
def set_uncertainty(self, new_uncertainty: Union[Number, str, None], new_uncertainty_type: str) -> None:
    """
    set uncertainty and uncertainty type

    Parameters
    ----------
    new_uncertainty : Number
        new uncertainty value
    new_uncertainty_type : str
        new uncertainty type

    Examples
    --------
    >>> import cript
    >>> my_condition = cript.Condition(
    ...     key="temperature",
    ...     type="value",
    ...     value=22,
    ...     unit="C",
    ... )
    >>> my_condition.set_uncertainty(new_uncertainty=0.2, new_uncertainty_type="stdev")

    Returns
    -------
    None
    """
    new_attrs = replace(self._json_attrs, uncertainty=new_uncertainty, uncertainty_type=new_uncertainty_type)
    self._update_json_attrs_if_valid(new_attrs)

set_value(new_value, new_unit)

set the value for this Condition subobject

Parameters:

Name Type Description Default
new_value Number

new value

required
new_unit str

units for the new value

required

Examples:

>>> import cript
>>> my_condition = cript.Condition(
...     key="temperature",
...     type="value",
...     value=22,
...     unit="C",
... )
>>> my_condition.set_value(new_value=1, new_unit="gram")

Returns:

Type Description
None
Source code in src/cript/nodes/subobjects/condition.py
def set_value(self, new_value: Union[Number, str], new_unit: str) -> None:
    """
    set the value for this Condition subobject

    Parameters
    ----------
    new_value : Number
        new value
    new_unit : str
        units for the new value

    Examples
    --------
    >>> import cript
    >>> my_condition = cript.Condition(
    ...     key="temperature",
    ...     type="value",
    ...     value=22,
    ...     unit="C",
    ... )
    >>> my_condition.set_value(new_value=1, new_unit="gram")

    Returns
    -------
    None
    """
    new_attrs = replace(self._json_attrs, value=new_value, unit=new_unit)
    self._update_json_attrs_if_valid(new_attrs)

type(new_type)

set the type attribute for this Condition node

Parameters:

Name Type Description Default
new_type str

new description of the Condition value

required

Returns:

Type Description
None
Source code in src/cript/nodes/subobjects/condition.py
@type.setter
@beartype
def type(self, new_type: str) -> None:
    """
    set the type attribute for this Condition node

    Parameters
    ----------
    new_type : str
        new description of the Condition value

    Returns
    -------
    None
    """
    new_attrs = replace(self._json_attrs, type=new_type)
    self._update_json_attrs_if_valid(new_attrs)

uncertainty()

set uncertainty value for this Condition subobject

Returns:

Name Type Description
uncertainty Union[Number, None]

uncertainty

Source code in src/cript/nodes/subobjects/condition.py
@property
@beartype
def uncertainty(self) -> Optional[Union[Number, str]]:
    """
    set uncertainty value for this Condition subobject

    Returns
    -------
    uncertainty: Union[Number, None]
        uncertainty
    """
    return self._json_attrs.uncertainty

uncertainty_type()

Uncertainty type for the uncertainty value

Uncertainty type must come from CRIPT controlled vocabulary

Returns:

Name Type Description
uncertainty_type str

uncertainty type

Source code in src/cript/nodes/subobjects/condition.py
@property
@beartype
def uncertainty_type(self) -> str:
    """
    Uncertainty type for the uncertainty value

    [Uncertainty type](https://app.criptapp.org/vocab/uncertainty_type) must come from CRIPT controlled vocabulary

    Returns
    -------
    uncertainty_type: str
        uncertainty type
    """
    return self._json_attrs.uncertainty_type

unit()

set units for this Condition subobject

Returns:

Name Type Description
unit str

units

Source code in src/cript/nodes/subobjects/condition.py
@property
@beartype
def unit(self) -> str:
    """
    set units for this Condition subobject

    Returns
    -------
    unit: str
        units
    """
    return self._json_attrs.unit

value()

value or quantity

Returns:

Type Description
Union[Number, None]

new value or quantity

Source code in src/cript/nodes/subobjects/condition.py
@property
@beartype
def value(self) -> Optional[Union[Number, str]]:
    """
    value or quantity

    Returns
    -------
    Union[Number, None]
        new value or quantity
    """
    return self._json_attrs.value