aurora.config.metadata package

Submodules

aurora.config.metadata.processing module

Extend the mt_metadata.transfer_functions.processing.aurora.processing.Processing class with some aurora-specific methods.

class aurora.config.metadata.processing.EMTFTFHeader(**kwargs)[source]

Bases: ListDict

Convenience class for storing metadata for a TF estimate. Based on Gary Egbert’s TFHeader.m originally in iris_mt_scratch/egbert_codes-20210121T193218Z-001/egbert_codes/matlabPrototype_10-13-20/TF/classes

It completely depends on the Processing class

Methods

append(obj)

Append an object

copy()

Copy object

extend(other[, skip_keys])

extend the dictionary from another ListDict object

remove(key)

remove an item based on key or index

sort([inplace])

sort the dictionary keys into alphabetical order

update(other)

Update from another ListDict

items

keys

values

class aurora.config.metadata.processing.Processing(**kwargs)[source]

Bases: Processing

Attributes:
band_edges_dict
changed
decimations
decimations_dict

need to have a dictionary, but it can’t be an attribute cause that

num_decimation_levels

Methods

add_base_attribute(name, value, value_dict)

Add an attribute to _attr_dict so it will be included in the output dictionary

add_decimation_level(decimation_level)

add a decimation level

assign_bands(band_edges_dict, sample_rate, ...)

Warning: This does not actually tell us how many samples we are decimating down at each level.

assign_decimation_level_data_emtf(sample_rate)

Warning: This does not actually tell us how many samples we are decimating down at each level.

attribute_information([name])

return a descriptive string of the attribute if none returns for all

copy()

Copy object

decimation_info()

Zips decimation level ids to the Decimation objects adn returns as a dict

emtf_tf_header(dec_level_id)

Returns a ListDict object that has the information that was in the old EMTF TF

from_dict(meta_dict[, skip_none])

fill attributes from a dictionary

from_json(json_str)

read in a json string and update attributes of an object

from_series(pd_series)

Fill attributes from a Pandas series

from_xml(xml_element)

param xml_element:

XML element

get_attr_from_name(name)

Access attribute from the given name.

get_attribute_list()

return a list of the attributes

get_decimation_level(level)

Get a decimation level for easy access

make_tf_level(dec_level_id)

Initialize container for a single decimation level -- "flat" transfer function.

save_as_json([filename, nested, required])

Exports self to a JSON

set_attr_from_name(name, value)

Helper function to set attribute from the given name.

to_dict([nested, single, required])

make a dictionary from attributes, makes dictionary from _attr_list.

to_json([nested, indent, required])

Write a json string from a given object, taking into account other class objects contained within the given object.

to_series([required])

Convert attribute list to a pandas.Series

to_xml([string, required])

make an xml element for the attribute that will add types and units.

update(other[, match])

Update attribute values from another like element, skipping None

validate_processing(kernel_dataset)

Placeholder.

window_scheme([as_type])

Make a dataframe of processing parameters one row per decimation level.

drop_reference_channels

json_fn

set_default_input_output_channels

set_default_reference_channels

set_input_channels

set_output_channels

set_reference_channels

decimation_info()[source]

Zips decimation level ids to the Decimation objects adn returns as a dict

Returns:

decimation_info – The decimation objects keyed by decimation level id.

Return type:

dict

emtf_tf_header(dec_level_id: int) ListDict[source]
Returns a ListDict object that has the information that was in the old EMTF TF

Header object. This may be deprecated in future – it is an artefact of the old matlab implementation.

Parameters:

dec_level_id (int) – This may tolerate strings in the future, but keep as int for now

Returns:

  • tfh (ListDict)

  • Object with the properties of the old EMTF TransferFunctionHeader class.

make_tf_level(dec_level_id: int)[source]

Initialize container for a single decimation level – “flat” transfer function.

Parameters:

dec_level_id (int) – This may tolerate strings in the future, but keep as int for now

Returns:

tf_obj

Return type:

aurora.transfer_function.TTFZ.TTFZ

save_as_json(filename: str | Path | None = None, nested: bool | None = True, required: bool | None = False) None[source]

Exports self to a JSON

Parameters:
  • filename (Optional[Union[str, pathlib.Path, None]) – Where to write the json

  • nested (Optional[bool] = True,) – An mt_metadata argument

  • required (Optional[bool] = False,) – An mt_metadata argument

window_scheme(as_type='df')[source]

Make a dataframe of processing parameters one row per decimation level.

Parameters:

as_type (Optional[str]) – if “df” return a dataframe, if “dict” return dict

Returns:

windowing – return type depends on as_type argument.

Return type:

Union[dict, pd.DataFrame]

Module contents

class aurora.config.metadata.Processing(**kwargs)[source]

Bases: Processing

Attributes:
band_edges_dict
changed
decimations
decimations_dict

need to have a dictionary, but it can’t be an attribute cause that

num_decimation_levels

Methods

add_base_attribute(name, value, value_dict)

Add an attribute to _attr_dict so it will be included in the output dictionary

add_decimation_level(decimation_level)

add a decimation level

assign_bands(band_edges_dict, sample_rate, ...)

Warning: This does not actually tell us how many samples we are decimating down at each level.

assign_decimation_level_data_emtf(sample_rate)

Warning: This does not actually tell us how many samples we are decimating down at each level.

attribute_information([name])

return a descriptive string of the attribute if none returns for all

copy()

Copy object

decimation_info()

Zips decimation level ids to the Decimation objects adn returns as a dict

emtf_tf_header(dec_level_id)

Returns a ListDict object that has the information that was in the old EMTF TF

from_dict(meta_dict[, skip_none])

fill attributes from a dictionary

from_json(json_str)

read in a json string and update attributes of an object

from_series(pd_series)

Fill attributes from a Pandas series

from_xml(xml_element)

param xml_element:

XML element

get_attr_from_name(name)

Access attribute from the given name.

get_attribute_list()

return a list of the attributes

get_decimation_level(level)

Get a decimation level for easy access

make_tf_level(dec_level_id)

Initialize container for a single decimation level -- "flat" transfer function.

save_as_json([filename, nested, required])

Exports self to a JSON

set_attr_from_name(name, value)

Helper function to set attribute from the given name.

to_dict([nested, single, required])

make a dictionary from attributes, makes dictionary from _attr_list.

to_json([nested, indent, required])

Write a json string from a given object, taking into account other class objects contained within the given object.

to_series([required])

Convert attribute list to a pandas.Series

to_xml([string, required])

make an xml element for the attribute that will add types and units.

update(other[, match])

Update attribute values from another like element, skipping None

validate_processing(kernel_dataset)

Placeholder.

window_scheme([as_type])

Make a dataframe of processing parameters one row per decimation level.

drop_reference_channels

json_fn

set_default_input_output_channels

set_default_reference_channels

set_input_channels

set_output_channels

set_reference_channels

decimation_info()[source]

Zips decimation level ids to the Decimation objects adn returns as a dict

Returns:

decimation_info – The decimation objects keyed by decimation level id.

Return type:

dict

emtf_tf_header(dec_level_id: int) ListDict[source]
Returns a ListDict object that has the information that was in the old EMTF TF

Header object. This may be deprecated in future – it is an artefact of the old matlab implementation.

Parameters:

dec_level_id (int) – This may tolerate strings in the future, but keep as int for now

Returns:

  • tfh (ListDict)

  • Object with the properties of the old EMTF TransferFunctionHeader class.

make_tf_level(dec_level_id: int)[source]

Initialize container for a single decimation level – “flat” transfer function.

Parameters:

dec_level_id (int) – This may tolerate strings in the future, but keep as int for now

Returns:

tf_obj

Return type:

aurora.transfer_function.TTFZ.TTFZ

save_as_json(filename: str | Path | None = None, nested: bool | None = True, required: bool | None = False) None[source]

Exports self to a JSON

Parameters:
  • filename (Optional[Union[str, pathlib.Path, None]) – Where to write the json

  • nested (Optional[bool] = True,) – An mt_metadata argument

  • required (Optional[bool] = False,) – An mt_metadata argument

window_scheme(as_type='df')[source]

Make a dataframe of processing parameters one row per decimation level.

Parameters:

as_type (Optional[str]) – if “df” return a dataframe, if “dict” return dict

Returns:

windowing – return type depends on as_type argument.

Return type:

Union[dict, pd.DataFrame]