dm.attrs package¶
Submodules¶
dm.attrs.AbstractPrepareAttr module¶
Calculates number of positive differences in given time points, geometric mean, arithmetic mean, variance and standard deviation of differences.
-
class
dm.attrs.AbstractPrepareAttr.
AbstractPrepareAttr
(row_selector, interval_selector, tr=None)¶ Bases:
abc.ABC
-
arithmetic_mean
(new_column_name, precision, values_before, values_after, prefix)¶ It computes arithmetic mean from given values before and after event.
- Parameters
new_column_name – name of attribute
precision – precision of calculation
values_before – list of values before event
values_after – list of values after event
prefix – prefix of attribute name
- Returns
pair of lists, each list contains pairs of attribute name and arithmetic mean
-
attr_name
(column_name, prefix, interval_type, interval)¶ It generates a name of attribute.
- Parameters
column_name – name of attribute
prefix – prefix of attribute name
interval_type – type of interval - before or after
interval – time interval from which the attribute is calculated
- Returns
name of attribute
-
abstract
execute
(**kwargs)¶ It ensures calculation of the required attribute.
- Parameters
kwargs –
- Returns
pair of lists, each list contains pair of attribute name and its value
-
geometric_mean
(new_column_name, precision, values_before, values_after, prefix)¶ It computes geometric mean from given values before and after event.
- Parameters
new_column_name – name of attribute
precision – precision of calculation
values_before – list of values before event
values_after – list of values after event
prefix – prefix of attribute name
- Returns
pair of lists, each list contains pairs of attribute name and geometric mean
-
standard_deviation
(new_column_name, precision, values_before, values_after, prefix)¶ It computes standard deviation from given values before and after event.
- Parameters
new_column_name – name of column
precision – precision of calculation
values_before – list of values before event
values_after – list of values after event
prefix – prefix of attribute name
- Returns
pair of lists, each list contains pairs of attribute name and standard deviation
-
variance
(new_column_name, precision, values_before, values_after, prefix)¶ It computes variance from given values before and after event.
- Parameters
new_column_name – name of column
precision – precision of calculation
values_before – list of values before event
values_after – list of values after event
prefix – prefix of attribute name
- Returns
pair of lists, each list contains pairs of attribute name and variance
-
dm.attrs.CO2VentilationLength module¶
Gets current value CO2 and measured value CO2 in a given time point.
-
class
dm.attrs.CO2VentilationLength.
CO2VentilationLength
(row_selector, interval_selector, tr=None)¶ Bases:
dm.attrs.AbstractPrepareAttr.AbstractPrepareAttr
-
execute
(timestamp_start, timestamp_end, compute_timestamp, intervals, method, co2_out, column, precision, prefix, enable_actual_value=True)¶ It computes how long ventilation was performed to decrease a CO2 concentration.
- Parameters
timestamp_start – timestamp when ventilation started
timestamp_end – timestamp when ventilation finished
compute_timestamp – selected timestamp during ventilation
intervals – deprecated
method – deprecated
co2_out – concentration of outside CO2
column – name of column that contains required values
precision – precision of calculation
prefix – prefix of attribute name
enable_actual_value – if the actual value should be included in output
- Returns
pair of lists, the first list contains at most two pairs, the first one (optional) includes attribute name and actual value, the second one includes attribute name and ventilation length
-
dm.attrs.DiffInLinear module¶
Calculates difference between quantity values after linearization (selects linearized values at the moment of window opening and closing).
-
class
dm.attrs.DiffInLinear.
DiffInLinear
(row_selector, interval_selector, tr=None)¶ Bases:
dm.attrs.InLinear.InLinear
-
execute
(timestamp_before, timestamp_after, column, precision, start_before, end_before, start_after, end_after, prefix, new_column_name)¶ It computes difference between quantity values after linearization.
After linearization time points at the moment of window opening and window closing are selected to compute difference.
- Parameters
timestamp_before – timestamp selected from linearized time interval before event
timestamp_after – timestamp selected from linearized time interval after event
column – name of column that contains required values
precision – precision of calculation
start_before – time shift before event that denotes start of time interval that is linearised (in seconds)
end_before – time shift before event that denotes end of time interval that is linearised (in seconds)
start_after – time shift after event that denotes start of time interval that is linearised (in seconds)
end_after – time shift after event that denotes end of time interval that is linearised (in seconds)
prefix – prefix of attribute name
new_column_name – name of attribute
- Returns
pair of lists, the first list contains pair including attribute name and difference between quantity values after linearization
-
dm.attrs.DifferenceBetweenRealLinear module¶
Calculates differences between real and linearized values of quantity in given time points.
-
class
dm.attrs.DifferenceBetweenRealLinear.
DifferenceBetweenRealLinear
(row_selector, interval_selector, tr=None)¶ Bases:
dm.attrs.AbstractPrepareAttr.AbstractPrepareAttr
-
execute
(timestamp, column, precision, intervals_before, intervals_after, window_size_before, window_size_after, prefix, new_column_name)¶ It computes difference between real and linearised course of given quantity.
- Parameters
timestamp – timestamp which is in the middle of time interval used for calculation
column – name of column that contains real values
precision – precision of calculation
intervals_before – list of time points before event
intervals_after – list of time points after event
window_size_before – time interval before event used to calculate linearised course
window_size_after – time interval after event used to calculate linearised course
prefix – prefix of attribute name
new_column_name – name of attribute
- Returns
pair of lists, each list contains pairs of attribute name and difference between real and linearised course of given quantity
-
dm.attrs.FirstDifferenceAttrA module¶
Calculates first differences using quantity values (not only successive values).
-
class
dm.attrs.FirstDifferenceAttrA.
FirstDifferenceAttrA
(row_selector, interval_selector, tr=None)¶ Bases:
dm.attrs.AbstractPrepareAttr.AbstractPrepareAttr
-
execute
(timestamp, column, precision, intervals_before, intervals_after, normalize, enable_count, prefix, selected_before, selected_after, new_column_name)¶ It computes the first differences using quantity values.
Not only successive values are used for computation.
- Parameters
timestamp – timestamp when event occurred
column – name of column that contains required values
precision – precision of calculation
intervals_before – list of time points before event
intervals_after – list of time points after event
normalize – if the computed should be normalized
enable_count – if number of positives values should be computed
prefix – prefix of attribute name
selected_before – list of lists of selected time points before event
selected_after – list of lists of selected time points after event
new_column_name – name of attribute
- Returns
pair of lists, each list contains pairs of attribute name and the first difference
-
dm.attrs.FirstDifferenceAttrB module¶
Calculates first differences using quantity values (only successive values).
-
class
dm.attrs.FirstDifferenceAttrB.
FirstDifferenceAttrB
(row_selector, interval_selector, tr=None)¶ Bases:
dm.attrs.AbstractPrepareAttr.AbstractPrepareAttr
-
execute
(timestamp, column, precision, intervals_before, intervals_after, normalize, enable_count, prefix, selected_before, selected_after, new_column_name)¶ It computes the first differences using quantity values.
Only successive values are used for computation.
- Parameters
timestamp – timestamp when event occurred
column – name of column that contains required values
precision – precision of calculation
intervals_before – list of time points before event
intervals_after – list of time points after event
normalize – if the computed should be normalized
enable_count – if number of positives values should be computed
prefix – prefix of attribute name
selected_before – list of lists of selected time points before event
selected_after – list of lists of selected time points after event
new_column_name – name of attribute
- Returns
pair of lists, each list contains pairs of attribute name and the first difference
-
dm.attrs.GrowthRate module¶
Calculates growth rates.
The growth rate is calculated as y_t/y_t_-1, where y_t is selected based on forward/backward shift and y_t_-1 is calculated as y_t - value_delay.
-
class
dm.attrs.GrowthRate.
GrowthRate
(row_selector, interval_selector, tr=None)¶ Bases:
dm.attrs.AbstractPrepareAttr.AbstractPrepareAttr
-
execute
(timestamp, column, precision, intervals_before, intervals_after, value_delay, prefix, new_column_name)¶ It computes growth rates.
- Parameters
timestamp – timestamp when event occurred
column – name of column that contains required values
precision – precision of calculation
intervals_before – list of time points before event
intervals_after – list of time points after event
value_delay – time shift used to get a value marked as y_t_-1
prefix – prefix of attribute name
new_column_name – name of attribute
- Returns
pair of lists, each list contains pairs of attribute name and growth rate
-
dm.attrs.InLinear module¶
Calculates quantity values after linearization.
-
class
dm.attrs.InLinear.
InLinear
(row_selector, interval_selector, tr=None)¶ Bases:
dm.attrs.AbstractPrepareAttr.AbstractPrepareAttr
-
execute
(timestamp_before, timestamp_after, column, precision, start_before, end_before, start_after, end_after, prefix, new_column_name)¶ It computes quantity values after linearization.
- Parameters
timestamp_before – timestamp selected from linearized time interval before event
timestamp_after – timestamp selected from linearized time interval after event
column – name of column that contains required values
precision – precision of calculation
start_before – time shift before event that denotes start of time interval that is linearised (in seconds)
end_before – time shift before event that denotes end of time interval that is linearised (in seconds)
start_after – time shift after event that denotes start of time interval that is linearised (in seconds)
end_after – time shift after event that denotes end of time interval that is linearised (in seconds)
prefix – prefix of attribute name
new_column_name – name of attribute
- Returns
pair of lists, each list contains pairs of attribute name and value after linearization
-
dm.attrs.InOutDiff module¶
Calculates differences between quantity values measured indoor and outdoor.
-
class
dm.attrs.InOutDiff.
InOutDiff
(row_selector, interval_selector, tr=None)¶ Bases:
dm.attrs.AbstractPrepareAttr.AbstractPrepareAttr
-
execute
(timestamp, column, precision, intervals_before, intervals_after, prefix, new_column_name)¶ It computes differences between quantity values measured indoor and outdoor.
- Parameters
timestamp – timestamp when event occurred
column – name of column that contains required values
precision – precision of calculation
intervals_before – list of time points before event
intervals_after – list of time points after event
prefix – prefix of attribute name
new_column_name – name of attribute
- Returns
pair of lists, each list contains pairs of attribute name and geometric mean
-
dm.attrs.Regression module¶
Calculates exponential regression from given CO2 values.
-
class
dm.attrs.Regression.
Regression
(row_selector, interval_selector, method)¶ Bases:
dm.attrs.AbstractPrepareAttr.AbstractPrepareAttr
-
execute
(timestamp_start, timestamp_end, column, precision, prefix, enable_error, new_column_name)¶ It computes exponential regression from given CO2 values.
- Parameters
timestamp_start – timestamp that denotes the start of time interval from which the regression is computed
timestamp_end – timestamp that denotes the end of time interval from which the regression is computed
column – name of column that contains required values
precision – precision of calculation
prefix – prefix of attribute name
enable_error – if an error of exponential regression is in the output
new_column_name – name of attribute
- Returns
pair of lists, the first list contains pair of attribute name and exponential regression from given CO2 values and pair of attribute name and error of exponential regression (optional)
-
static
gen_f_lambda
(co2_start, co2_out)¶
-
static
gen_f_prietok
(co2_start, co2_out, volume)¶
-
dm.attrs.SecondDifferenceAttr module¶
Calculates second differences using quantity values.
-
class
dm.attrs.SecondDifferenceAttr.
SecondDifferenceAttr
(row_selector, interval_selector, tr=None)¶ Bases:
dm.attrs.FirstDifferenceAttrB.FirstDifferenceAttrB
-
execute
(timestamp, column, precision, intervals_before, intervals_after, normalize, enable_count, prefix, selected_before, selected_after, new_column_name)¶ It computes the second differences using quantity values.
- Parameters
timestamp – timestamp when event occurred
column – name of column that contains required values
precision – precision of calculation
intervals_before – list of time points before event
intervals_after – list of time points after event
normalize – if the computed should be normalized
enable_count – if number of positives values should be computed
prefix – prefix of attribute name
selected_before – list of lists of selected time points before event
selected_after – list of lists of selected time points after event
new_column_name – name of attribute
- Returns
pair of lists, each list contains pairs of attribute name and the second difference
-
dm.attrs.VentilationLength module¶
Assigns given ventilation length to a class.
-
class
dm.attrs.VentilationLength.
VentilationLength
(row_selector, interval_selector, tr=None)¶ Bases:
dm.attrs.AbstractPrepareAttr.AbstractPrepareAttr
-
execute
(event_start, event_end, intervals, threshold, prefix)¶ It assigns given ventilation length to a class.
- Parameters
event_start – timestamp that denotes the start of the event
event_end – timestamp that denotes the end of the event
intervals – intervals representing classes to which the events can be assigned
threshold – threshold used in evaluation to which class the event should be assigned
prefix – prefix of attribute name
- Returns
pair of lists, each list contains pairs of attribute name and assigned interval (class)
-