CapData

The CapData class is the core interface for capacity testing. It holds raw and filtered data, column group mappings, filter history, and regression results.

capdata.CapData(name)

Class to store capacity test data and column grouping.

Setup

Methods that must be called after loading data and before filtering or fitting a regression. Use set_regression_cols() to map regression terms to column names or column group ids, then call process_regression_columns() to validate and prepare those mappings. custom_param() adds a column of derived values (e.g. temperature-corrected power or spectral corrections) directly to the CapData instance; see Calculation Parameters for the available calculation functions.

capdata.CapData.set_regression_cols([power, ...])

Create a dictionary linking the regression variables to data.

capdata.CapData.process_regression_columns([...])

Walk the regression column dictionary and calculate parameters.

capdata.CapData.custom_param(func, *args, ...)

Applies the function func with kwargs and adds result as new column to data.

Data Management

Methods for inspecting, renaming, copying, and exporting data.

capdata.CapData.get_reg_cols([reg_vars, ...])

Get regression columns renamed with keys from regression_cols.

capdata.CapData.review_column_groups()

Print column_groups with nice formatting.

capdata.CapData.copy()

Create and returns a copy of self.

capdata.CapData.empty()

Return a boolean indicating if the CapData object contains data.

capdata.CapData.drop_cols(columns)

Drop columns from CapData data and column_groups.

capdata.CapData.rename_cols(column_map)

Rename columns in data and column_groups.

Aggregation

Methods for aggregating sensor readings into single representative columns.

capdata.CapData.agg_sensors([agg_map, verbose])

Aggregate measurments of the same variable from different sensors.

capdata.CapData.agg_group(group_id, agg_func)

Aggregate columns in a group.

capdata.CapData.expand_agg_map(agg_map)

Traverses, expands, and sorts the agg_map.

capdata.CapData.reset_agg()

Remove aggregation columns from data and data_filtered attributes.

Filtering

Thin wrappers that build a step class from captest.filters and run() it, appending it to the CapData.filters chain (the single source of truth from which data_filtered is derived). Each accepts an optional custom_name label. describe_filters returns a written summary of the run, while filters_to_config / run_pipeline serialize and replay the chain. See Filters for the underlying step classes.

capdata.CapData.filter_irr(low, high[, ...])

Filter on irradiance values.

capdata.CapData.filter_pvsyst([custom_name])

Remove PVsyst intervals operating off the maximum power point.

capdata.CapData.filter_shade([fshdbm, ...])

Remove intervals of array shading.

capdata.CapData.filter_time([start, end, ...])

Select data for a specified time period.

capdata.CapData.filter_days(days[, drop, ...])

Keep or drop the timestamps belonging to a list of days.

capdata.CapData.filter_outliers([custom_name])

Apply EllipticEnvelope from scikit-learn to remove outliers in (poa, power).

capdata.CapData.filter_pf(pf[, custom_name])

Remove intervals with a power factor below pf.

capdata.CapData.filter_power(power[, ...])

Remove intervals at or above a power threshold.

capdata.CapData.filter_rolling_std(window, ...)

Remove intervals where a column's rolling std is at or above a threshold.

capdata.CapData.filter_abs_diff_prev([...])

Remove intervals with a large fractional change from the prior interval.

capdata.CapData.filter_flag(column[, ...])

Remove intervals where a boolean/flag column is truthy.

capdata.CapData.filter_threshold(column[, ...])

Keep intervals where column is within [low, high].

capdata.CapData.filter_custom(func, *args[, ...])

Apply func to data_filtered as a row filter and record the step.

capdata.CapData.filter_sensors([thresholds, ...])

Drop suspicious measurements by comparing readings across sensors.

capdata.CapData.filter_sensors_abs_diff(...)

Drop rows where a sensor deviates from its group average by too much.

capdata.CapData.filter_clearsky([ghi_col, ...])

Remove unstable-irradiance intervals using pvlib detect_clearsky.

capdata.CapData.filter_backtracking([...])

Remove intervals where single-axis-tracker backtracking is active.

capdata.CapData.filter_missing([columns, ...])

Remove rows with missing data (NaN) in the regression columns.

capdata.CapData.filter_op_state(op_state[, ...])

NOT CURRENTLY IMPLEMENTED - Filter on inverter operation state.

capdata.CapData.reset_filter()

Set data_filtered to data and reset filtering summary.

capdata.CapData.describe_filters()

Return a written, human-readable summary of the filtering run.

capdata.CapData.filters_to_config()

Serialize the applied filter chain to a list of config dicts.

capdata.CapData.run_pipeline(config)

Rebuild and run each filter step from a list of config dicts.

Reporting Conditions

Methods for computing ASTM E2848 reporting conditions. rep_irr is the reporting POA irradiance used to anchor filter_irr(ref_val='rep_irr'); within a CapTest it resolves from the single test RC. See Reporting Conditions in the user guide.

capdata.CapData.rep_cond([func, w_vel, ...])

Calculate reporting conditions for the current regression formula.

capdata.CapData.rep_cond_freq([irr_bal, ...])

Calculate frequency-grouped reporting conditions.

capdata.CapData.rep_irr

Reporting POA irradiance anchoring relative irradiance filters.

Regression

Methods for fitting the ASTM E2848 regression and predicting capacities.

capdata.CapData.fit_regression([filter, ...])

Perform a regression with statsmodels on the filtered data.

capdata.CapData.predict_capacities([...])

Calculate expected capacities.

Results and Uncertainty

Methods for quantifying test results, uncertainty, and completeness.

capdata.CapData.uncertainty()

Calculate random standard uncertainty of the regression.

capdata.CapData.spatial_uncert(column_groups)

Spatial uncertainties of the independent regression variables.

capdata.CapData.expanded_uncert(grp_to_term)

Calculate expanded uncertainty of the predicted power.

capdata.CapData.get_filtering_table()

Returns DataFrame showing which filter removed each filtered time interval.

capdata.CapData.get_summary()

Return a DataFrame summarizing the applied filter chain.

capdata.CapData.print_points_summary([hrs_req])

print summary data on the number of points collected.

capdata.CapData.get_length_test_period()

Get length of test period.

capdata.CapData.get_pts_required([hrs_req])

Set number of data points required for complete test attribute.

capdata.CapData.set_test_complete(pts_required)

Sets test_complete attribute.

Visualization

Methods for scatter plots, filter inspection, and interactive dashboards.

capdata.CapData.scatter([filtered])

Create a matplotlib scatter plot of regression lhs vs.

capdata.CapData.scatter_hv([timeseries, ...])

Create a holoviews scatter plot of regression lhs vs.

capdata.CapData.plot([combine, ...])

Create a dashboard to explore timeseries plots of the data.

capdata.CapData.reg_scatter_matrix()

Create pandas scatter matrix of regression variables.

capdata.CapData.scatter_filters()

Overlay of power-vs-irradiance scatters attributing removed intervals.

capdata.CapData.timeseries_filters()

Power-vs-time line with removed intervals highlighted per filter.

Export

Methods for writing data and column groups to Excel.

capdata.CapData.data_columns_to_excel([...])

Write the columns of data to an excel file as a template for a column grouping.

capdata.CapData.column_groups_to_excel([save_to])

Export the column groups attribute to an excel file.