Classes for measurements¶
The following classes are used to represent values related to measurements.
Contents
Date¶
-
class
Date¶ Dateis used for representation of dates. This is for extending the conventionaldateobject of JSON.for example, you can represent the date in several different formats:
The following objects represent the same date¶{ "format": "%Y-%m-%d", "value": "2019-01-22" }, { "format": "%d/%m/%y", "value": "22/01/19" }
-
format¶ a required
stringproperty used for how to parse thevaluefield.In principle, the field names follow the specifications in the UNIX command
date. The following fields are allowed for the moment:Field Description %Ya 4-digit year field %ya 2-digit year field %ma 2-digit month field %da 2-digit date field Other than the fields above, the following special characters can be used:
-(hyphen),(comma).(period)/(slash)- `` `` (space)
Caution
A warning may be raised if the format does _not_ contain all of year/month/day fields.
-
Time¶
-
class
Time¶ Timeis used for representation of dates. This is for extending the conventionaltimeobject of JSON.for example, you can represent the date in several different formats:
Examples of Time instances¶{ "format": "%H-%M-%S", "value": "09-25-22" }, { "format": "%H:%M", "value": "09:25" }
-
format¶ a required
stringproperty used for how to parse thevaluefield.In principle, the field names follow the specifications in the UNIX command
date. The following fields are allowed for the moment:Field Description %Ha 2-digit 24-hour field %Ma 2-digit minute field %Sa 2-digit second field %fa field representing subsecond time (up to microseconds) Other than the fields above, the following special characters can be used:
:(colon)-(hyphen),(comma).(period)/(slash)- `` `` (space)
In case the finer scales are not specified (e.g. having only
%Hand%M, and not the others), having zeros for them is assumed. For example, if you format"09:50"with the formatter"%H:%M", you can expect to represent either"09:50:00"or"09:50:00.000000", depending on the runtime.Caution
You cannot format a value only consisting of e.g.
%Hand%S, and skipping%M.
-
Space¶
-
class
Space¶ Spacerepresents an N-dimensional space with an optional unit.Typically, this class is used for description of a scan strategy (e.g. line scan, imaging etc.), or the shape of an electrode.
The
scaleproperty may optionally be set to describe a conversion from the (probably unit-less) value represented here to a certain “well-known” unit (e.g. to represent mm/px).-
shape¶ a required array consisting of
integerelements. The size of the array represents the dimension of this region, and each element represents the length of each edge of this region.
-
description¶ an optional array consisting of
stringelements. This field is supposed to hold human-readable representations of what each dimension ofshapestands for (e.g. “size”, “width”, “pole”, “shank”).
-
unit¶ an optional
stringproperty to represent the unit for this size. If not set, a default unit (such aspixelorvoxel) will be assumed. Please read Notes on unit usages.
-
scale¶ an optional
Quantityproperty to represent the conversion scale between the size described here (as the numerator) and a more commonly used unit (as the demoninator).For the “commonly-used” unit, please refer to Notes on unit usages.
-
Quantity¶
Quantity is used to represent values with units.
For example, the following entry is used to describe “30.0 Hz”:
{
"type": "number",
"value": "29.99999999999",
"precision": 3,
"unit": "Hz"
}
-
class
Quantity¶ -
type¶ a required
stringproperty specifying the type of the value. Normally,"number"(floating-point number) comes here.
-
value¶ a required
stringproperty representing the value of this quantity. Note that it is not numeric itself, e.g. innumber. This field must hold a string representation of the value, and it is formatted later to the type specified by thetypeproperty.
-
precision¶ an optional
integerproperty specifying the number of decimal places that are scientifically valid. This field is taken into account probably only when thetypeproperty is"number"or"float"; iftypeis"integer"or"string", this field is ignored even when set.
-
unit¶ an optional
stringproperty indicating the unit of this quantity. Please read Notes on unit usages.
-
Notes on unit usages¶
Caution
Although it is up to the users to use any arbitrary units in the "unit" field,
it is recommended to use one of widely accepted and commonly used units.
As an example, refer to this guide by International Astronomical Union (IAU).