myData

class zdm.data_class.myData[source]

Bases: object

Methods Summary

from_dict(param_dict)

from_jsonfile(jfile)

Load from a JSON file

from_jsonstr(jsonstr)

set_dataclasses()

set_params()

Generate a simple dict for parameters

to_dict()

Generate a dict holding all of the object parameters

update_param(param, value)

Update the value of a single parameter

update_param_dict(params)

update_params(params)

Update the state parameters using the input dict

vet(obj, dmodel[, verbose])

Vet the input object against its data model

write(outfile)

Write the parameters to a JSON file

Methods Documentation

classmethod from_dict(param_dict: dict)[source]
classmethod from_jsonfile(jfile: str)[source]

Load from a JSON file

Parameters:

jfile (str) – name of the JSON file

Return type:

myDataClass

classmethod from_jsonstr(jsonstr: str)[source]
set_dataclasses()[source]
set_params()[source]

Generate a simple dict for parameters

to_dict()[source]

Generate a dict holding all of the object parameters

Returns:

[description]

Return type:

dict

update_param(param: str, value)[source]

Update the value of a single parameter

Parameters:
  • param (str) – name of the parameter

  • value – value

update_param_dict(params: dict)[source]
update_params(params: dict)[source]

Update the state parameters using the input dict

Parameters:

params (dict) – New parameters+values

vet(obj, dmodel: dict, verbose=True)[source]

Vet the input object against its data model

Parameters:
  • obj (dict or pandas.DataFrame) – Instance of the data model

  • dmodel (dict) – Data model

  • verbose (bool) – Print when something doesn’t check

Returns:

chk (bool), disallowed_keys (list), badtype_keys (list)

Return type:

tuple

write(outfile: str)[source]

Write the parameters to a JSON file

Parameters:

outfile (str) – name of output file

__init__()[source]
classmethod from_dict(param_dict: dict)[source]
classmethod from_jsonfile(jfile: str)[source]

Load from a JSON file

Parameters:

jfile (str) – name of the JSON file

Return type:

myDataClass

classmethod from_jsonstr(jsonstr: str)[source]
set_dataclasses()[source]
set_params()[source]

Generate a simple dict for parameters

__getitem__(attrib: str)[source]

Enables dict like access to the state

Parameters:

attrib (str) – name of the attribute

Returns:

Value of the attribute requested

Return type:

?

update_param_dict(params: dict)[source]
update_params(params: dict)[source]

Update the state parameters using the input dict

Parameters:

params (dict) – New parameters+values

update_param(param: str, value)[source]

Update the value of a single parameter

Parameters:
  • param (str) – name of the parameter

  • value – value

to_dict()[source]

Generate a dict holding all of the object parameters

Returns:

[description]

Return type:

dict

write(outfile: str)[source]

Write the parameters to a JSON file

Parameters:

outfile (str) – name of output file

vet(obj, dmodel: dict, verbose=True)[source]

Vet the input object against its data model

Parameters:
  • obj (dict or pandas.DataFrame) – Instance of the data model

  • dmodel (dict) – Data model

  • verbose (bool) – Print when something doesn’t check

Returns:

chk (bool), disallowed_keys (list), badtype_keys (list)

Return type:

tuple