numina.types — Data types

class numina.types.base.DataTypeBase(*args, **kwds)

Base class for input/output types of recipes.

static create_db_info()

Create metadata structure

extract_db_info(obj, db_info_keys)

Extract metadata from serialized file

extract_tags(obj)

Create metadata structure

classmethod isproduct()

Check if the DataType is the product of a Recipe

name()

Unique name of the datatype

update_meta_info()

Extract my metadata

class numina.types.array.ArrayNType(dimensions, default=None)
class numina.types.array.ArrayType(fmt='%.18e', default=None)

A type of array.

convert(obj)

Basic conversion to internal type

This method is intended to be redefined by subclasses

Basic Data Products

class numina.types.dataframe.DataFrame(frame=None, filename=None)

A handle to a image in disk or in memory.

class numina.types.datatype.AnyType

Type representing anything

convert(obj)

Basic conversion to internal type

This method is intended to be redefined by subclasses

validate(obj)

Validate convertibility to internal representation

Returns:

True if ‘obj’ matches the data type

Return type:

bool

Raises:

ValidationError – If the validation fails

class numina.types.datatype.AutoDataType(*args, **kwargs)

Data type for types that are its own python type

class numina.types.datatype.DataType(ptype, node_type=None, default=None, **kwds)

Base class for input/output types of recipes.

convert(obj)

Basic conversion to internal type

This method is intended to be redefined by subclasses

convert_in(obj)

Basic conversion to internal type of inputs.

This method is intended to be redefined by subclasses

convert_out(obj)

Basic conversion to internal type of outputs.

This method is intended to be redefined by subclasses

validate(obj)

Validate convertibility to internal representation

Returns:

True if ‘obj’ matches the data type

Return type:

bool

Raises:

ValidationError – If the validation fails

class numina.types.datatype.ListOfType(ref, default=None, index=0, nmin=None, nmax=None, accept_scalar=False, multi_query=None)

Data type for lists of other types.

convert(obj)

Basic conversion to internal type

This method is intended to be redefined by subclasses

validate(obj)

Validate convertibility to internal representation

Returns:

True if ‘obj’ matches the data type

Return type:

bool

Raises:

ValidationError – If the validation fails

class numina.types.datatype.NullType

Data type for None.

convert(obj)

Basic conversion to internal type

This method is intended to be redefined by subclasses

validate(obj)

Validate convertibility to internal representation

Returns:

True if ‘obj’ matches the data type

Return type:

bool

Raises:

ValidationError – If the validation fails

class numina.types.datatype.PlainPythonType(ref=None, validator=None)

Data type for Python basic types.

convert(obj)

Basic conversion to internal type

This method is intended to be redefined by subclasses

class numina.types.frame.DataFrameType(datamodel=None)

A type of DataFrame.

convert(obj)

Convert

extract_db_info(obj, keys)

Extract tags from serialized file

validate(value)
class numina.types.linescatalog.DataProductType(ptype, default=None)
class numina.types.linescatalog.LinesCatalog
extract_db_info(obj, keys)

Extract metadata from serialized file

class numina.types.multitype.MultiType(*args)
extract_tags(obj)

Extract tags from obj

isproduct()

Check if the DataType is the product of a Recipe

validate(obj)

Validate convertibility to internal representation

Returns:

True if ‘obj’ matches the data type

Return type:

bool

Raises:

ValidationError – If the validation fails

Quality control for Numina-based applications.

class numina.types.qc.QC(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

QA Levels

The numeric values of the QC levels are given in this table.

Level

Numeric value

GOOD

100

FAIR

90

BAD

70

class numina.types.structured.BaseStructuredCalibration(instrument='unknown', datamodel=None)

Base class for structured calibration data

Parameters:

instrument (str) – Instrument name

tags

dictionary of selection fields

Type:

dict

uuid

UUID of the result

Type:

str

extract_db_info(obj, keys)

Extract metadata from serialized file

extract_tags(obj)

Extract tags

update_meta_info()

Extract metadata from myself

numina.types.structured.load(fd)

” Load a JSON file as a structured object

fd: file or file-like

File to be opened

numina.types.structured.open(name)

” Open a JSON file as a structured object

namestr or file or file-like or pathlib.Path

File to be opened

numina.types.structured.writeto(obj, name)

Write a BaseStructuredCalibration to a named file

Parameters: