mth5.tables package

Submodules

mth5.tables.channel_table module

Created on Wed Mar 23 14:09:38 2022

@author: jpeacock

class mth5.tables.channel_table.ChannelSummaryTable(hdf5_dataset)[source]

Bases: MTH5Table

Object to hold the channel summary and provide some convenience functions like fill, to_dataframe …

summarize()[source]
Returns

DESCRIPTION

Return type

TYPE

to_dataframe()[source]

Create a pandas DataFrame from the table for easier querying.

Returns

Channel Summary

Return type

pandas.DataFrame

mth5.tables.mth5_table module

Created on Wed Dec 23 16:53:55 2020

author

Jared Peacock

license

MIT

class mth5.tables.mth5_table.MTH5Table(hdf5_dataset)[source]

Bases: object

Use the underlying NumPy basics, there are simple actions in this table, if a user wants to use something more sophisticated for querying they should try using a pandas table. In this case entries in the table are more difficult to change and datatypes need to be kept track of.

add_row(row, index=None)[source]

Add a row to the table.

row must be of the same data type as the table

Parameters
  • row (TYPE) – row entry for the table

  • index (integer, if None is given then the row is added to the end of the array) – index of row to add

Returns

index of the row added

Return type

integer

check_dtypes(other_dtype)[source]

Check to make sure datatypes match

clear_table()[source]

clear a table,

Basically delete the table and start over :return: DESCRIPTION :rtype: TYPE

property dtype
locate(column, value, test='eq')[source]

locate index where column is equal to value :param column: DESCRIPTION :type column: TYPE :param value: DESCRIPTION :type value: TYPE :type test: type of test to try * ‘eq’: equals * ‘lt’: less than * ‘le’: less than or equal to * ‘gt’: greater than * ‘ge’: greater than or equal to. * ‘be’: between or equal to * ‘bt’: between

If be or bt input value as a list of 2 values

Returns

DESCRIPTION

Return type

TYPE

property nrows
remove_row(index)[source]

Remove a row

Note

that there is not index value within the array, so the indexing is on the fly. A user should use the HDF5 reference instead of index number that is the safest and most robust method.

Parameters

index (TYPE) – DESCRIPTION

Returns

DESCRIPTION

Return type

TYPE

This isn’t as easy as just deleteing an element. Need to delete the element from the weakly referenced array and then set the summary table dataset to the new array.

So set to a null array for now until a more clever option is found.

property shape
to_dataframe()[source]

Convert the table into a pandas.DataFrame object.

Returns

convert table into a pandas.DataFrame with the appropriate data types.

Return type

pandas.DataFrame

update_row(entry)[source]

Update an entry by first locating the index and then rewriting the entry.

Parameters

entry (np.ndarray) – numpy array with same datatype as the table

Returns

row index.

This doesn’t work because you cannot test for hdf5_reference, should use add row and locate by index.

mth5.tables.tf_table module

Created on Wed Mar 23 14:09:38 2022

@author: jpeacock

class mth5.tables.tf_table.TFSummaryTable(hdf5_dataset)[source]

Bases: MTH5Table

Object to hold the channel summary and provide some convenience functions like fill, to_dataframe …

summarize()[source]
Returns

DESCRIPTION

Return type

TYPE

to_dataframe()[source]

Create a pandas DataFrame from the table for easier querying.

Returns

Channel Summary

Return type

pandas.DataFrame

Module contents

class mth5.tables.ChannelSummaryTable(hdf5_dataset)[source]

Bases: MTH5Table

Object to hold the channel summary and provide some convenience functions like fill, to_dataframe …

summarize()[source]
Returns

DESCRIPTION

Return type

TYPE

to_dataframe()[source]

Create a pandas DataFrame from the table for easier querying.

Returns

Channel Summary

Return type

pandas.DataFrame

class mth5.tables.MTH5Table(hdf5_dataset)[source]

Bases: object

Use the underlying NumPy basics, there are simple actions in this table, if a user wants to use something more sophisticated for querying they should try using a pandas table. In this case entries in the table are more difficult to change and datatypes need to be kept track of.

add_row(row, index=None)[source]

Add a row to the table.

row must be of the same data type as the table

Parameters
  • row (TYPE) – row entry for the table

  • index (integer, if None is given then the row is added to the end of the array) – index of row to add

Returns

index of the row added

Return type

integer

check_dtypes(other_dtype)[source]

Check to make sure datatypes match

clear_table()[source]

clear a table,

Basically delete the table and start over :return: DESCRIPTION :rtype: TYPE

property dtype
locate(column, value, test='eq')[source]

locate index where column is equal to value :param column: DESCRIPTION :type column: TYPE :param value: DESCRIPTION :type value: TYPE :type test: type of test to try * ‘eq’: equals * ‘lt’: less than * ‘le’: less than or equal to * ‘gt’: greater than * ‘ge’: greater than or equal to. * ‘be’: between or equal to * ‘bt’: between

If be or bt input value as a list of 2 values

Returns

DESCRIPTION

Return type

TYPE

property nrows
remove_row(index)[source]

Remove a row

Note

that there is not index value within the array, so the indexing is on the fly. A user should use the HDF5 reference instead of index number that is the safest and most robust method.

Parameters

index (TYPE) – DESCRIPTION

Returns

DESCRIPTION

Return type

TYPE

This isn’t as easy as just deleteing an element. Need to delete the element from the weakly referenced array and then set the summary table dataset to the new array.

So set to a null array for now until a more clever option is found.

property shape
to_dataframe()[source]

Convert the table into a pandas.DataFrame object.

Returns

convert table into a pandas.DataFrame with the appropriate data types.

Return type

pandas.DataFrame

update_row(entry)[source]

Update an entry by first locating the index and then rewriting the entry.

Parameters

entry (np.ndarray) – numpy array with same datatype as the table

Returns

row index.

This doesn’t work because you cannot test for hdf5_reference, should use add row and locate by index.

class mth5.tables.TFSummaryTable(hdf5_dataset)[source]

Bases: MTH5Table

Object to hold the channel summary and provide some convenience functions like fill, to_dataframe …

summarize()[source]
Returns

DESCRIPTION

Return type

TYPE

to_dataframe()[source]

Create a pandas DataFrame from the table for easier querying.

Returns

Channel Summary

Return type

pandas.DataFrame