FHanalyze package

The FHanalyze package analyzes the readings that were stored into the Raspberry Pi’s mongo db by calls to the FHmonitor package.

Analyze class

The analyze class takes the power readings from the mongodb store and provides methods to analyze the readings.

class FHanalyze.analyze.Analyze(mongodb_path='mongodb://127.0.0.1:27017', db_str='FitHome', collection_name='aggregate')[source]

The Analyze class connects to the mongodb collection that contains the power readings saved by the FHmonitor.

To get an instance of the Analyze class, pass into __init__:

Parameters:
  • mongodb_path – The mongodb connection string. See the connection string documentation. Defaults to “mongodb://127.0.0.1:27017”.
  • db_str – The database within mongodb that holds the readings. Defaults to “FitHome”.
  • collection_name – The collection within the database where the readings are stored. Defaults to “aggregate”.
get_DataFrame_for_date(date_str='*')[source]

Return the active Power readings for a specific date or for all dates.

Parameters:date – isodate formatted date or “*”. Defaults to “*”
Returns:A pandas DataFrame with a dateindex and a column named ‘pA’ of active power readings.
get_always_on_watts(date_str='*', start_time='*', end_time='*', quantile=0.3)[source]

Return the amount of power (in watts) that are wasted by appliances that are always plugged in and use electricity, even when the appliance is not being used.

Parameters:
  • date_str – Either a date in isodate format to use readings in the calculation for that date or ‘*’ to use all available dates for the calculation. Defaults to ‘*’
  • start_time – Use readings that are taken at this time. The start_time is the beginning of an amount of time to filter results. Defaults to ‘*’
  • end_time – Use readings that are taken before this time. end_time is used with start_time to filter readings to be within the time between start_time and end_time. Defaults to ‘*’
  • quantile – A floating point number between 0 and 1 that cuts the distribution of readings. For example, a value of .3 means the always_on_watts value is taken at the place where 30% of the readings are found. Defaults to .3.
get_isodate_list()[source]

Get the list of dates in isodate format that contain active and reactive power readings.

Returns:list of isodates that contain power readings.