This page was generated from docs/examples/captest_from_config.ipynb. Interactive online version: Binder badge

Capacity Test from pvcaptest Configuration YAML file

This notebook shows how a capacity test can be re-produced for review, further exploration, and validation using a yaml configuation file created by the CapTest.to_yaml method. The yaml configuation file read into this notebook (bifi_config.yaml) was produced from the example test notebook captest_class_bifi.ipynb, see last section of the notebook.

The results of this test produced using the configuation yaml file (bifi_config.yaml) are identical to the example test notebook captest_class_bifi.ipynb that was used to produce the bifi_config.yaml.

[1]:
import captest as ct

Create CapTest from Config file

The from_yaml option to create a CapTest instance will load, calculate regressors, and apply the filters defined in the config file to the measured and simulated data.

[2]:
tst = ct.CapTest.from_yaml('./bifi_config.yaml')
/home/docs/checkouts/readthedocs.org/user_builds/pvcaptest/checkouts/latest/src/captest/io.py:207: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  data_file = pd.read_csv(
/home/docs/checkouts/readthedocs.org/user_builds/pvcaptest/checkouts/latest/src/captest/io.py:237: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
  data_file = pd.read_csv(
Aggregating the below 1 columns of the real_pwr_mtr group using the sum function. New column name: real_pwr_mtr_sum_agg:
    Example Project_Elkor Production Meter_Elkor Production Meter, KW


Aggregating the below 2 columns of the irr_poa group using the mean function. New column name: irr_poa_mean_agg:
    Example Project_Weather Station 1 (Standard w/ POA GHI)_Weather Station 1 (Standard w/ POA GHI), Sun
    Example Project_Weather Station 2 (Standard with POA GHI)_Weather Station 2 (Standard with POA GHI), Sun


Aggregating the below 2 columns of the irr_rpoa group using the mean function. New column name: irr_rpoa_mean_agg:
    Example Project_Weather Station 1_RPOA
    Example Project_Weather Station 2_RPOA


Calculating and adding "e_total" column as irr_poa_mean_agg + irr_rpoa_mean_agg * 0.7 (bifaciality) * 1.0 (bifacial fraction) * (1 - 0.0 (rear shade))
Aggregating the below 2 columns of the temp_amb group using the mean function. New column name: temp_amb_mean_agg:
    Example Project_Weather Station 1 (Standard w/ POA GHI)_Weather Station 1 (Standard w/ POA GHI), TempF
    Example Project_Weather Station 2 (Standard with POA GHI)_Weather Station 2 (Standard with POA GHI), TempF


Aggregating the below 2 columns of the wind_speed group using the mean function. New column name: wind_speed_mean_agg:
    Example Project_Weather Station 1 (Standard w/ POA GHI)_Weather Station 1 (Standard w/ POA GHI), WindSpeed
    Example Project_Weather Station 2 (Standard with POA GHI)_Weather Station 2 (Standard with POA GHI), WindSpeed


Calculating and adding "rpoa_pvsyst" column as GlobBak + BackShd.
Calculating and adding "e_total" column as GlobInc + rpoa_pvsyst * 0.7 (bifaciality) * 1.0 (bifacial fraction) * (1 - 0 (rear shade))
Reporting conditions saved to rc attribute.
          poa      t_amb     w_vel
0  810.175074  25.142031  2.220261

Measured Data

Data Plot

[3]:
tst.meas.plot()
[3]:

Filtering Summary

[4]:
tst.meas.get_summary()
[4]:
function_name pts_after_filter pts_removed filter_arguments
meas Custom Custom 1424 16 dropna()
Irradiance Irradiance 452 972 high=1400, low=400
Outliers Outliers 433 19 EllipticEnvelope(support_fraction=0.9, contami...
Regression Regression 405 28 n_std=2
RepCond RepCond 405 0 front_poa=poa, irr_bal=False, percent_filter=20
Irradiance-1 Irradiance 157 248 high=1.2, low=0.8, ref_val=810.1750741447345
[5]:
print(tst.meas.describe_filters())
Custom filter dropna() was applied.
Intervals where e_total is below 400 or above 1400 W/m^2 were removed.
Statistical outliers in (poa, power), detected via EllipticEnvelope(support_fraction=0.9, contamination=0.04), were removed.
Intervals with regression residuals beyond 2 standard deviations were removed.
Reporting conditions were calculated (no intervals removed).
Intervals where e_total is below 648.1400593157877 or above 972.2100889736813 W/m^2 were removed.

Filtering Vizualizations

[6]:
tst.meas.scatter_filters() + tst.meas.timeseries_filters().opts(width=1_000)
[6]:

Linked Scatter Plot and Timeseries

The regression data set after filtering plotted as a scatter plot of POA irradiance against temperature corrected power. The temperature correction is applied by the plot, so this visualization can be used with in a test notebook that does not use temperature corrected power in the regression like this one.

[7]:
tst.scatter_plots(timeseries=True, tc_power=True, tc_mode='replace')
[7]:

Regression

[8]:
tst.meas.fit_regression()
                                 OLS Regression Results
=======================================================================================
Dep. Variable:                  power   R-squared (uncentered):                   0.999
Model:                            OLS   Adj. R-squared (uncentered):              0.999
Method:                 Least Squares   F-statistic:                          2.721e+04
Date:                Fri, 17 Jul 2026   Prob (F-statistic):                   4.59e-217
Time:                        21:21:03   Log-Likelihood:                         -2105.3
No. Observations:                 157   AIC:                                      4219.
Df Residuals:                     153   BIC:                                      4231.
Df Model:                           4
Covariance Type:            nonrobust
==================================================================================
                     coef    std err          t      P>|t|      [0.025      0.975]
----------------------------------------------------------------------------------
poa             6963.3980    253.380     27.482      0.000    6462.824    7463.972
I(poa * poa)      -0.1401      0.192     -0.731      0.466      -0.518       0.238
I(poa * t_amb)   -60.4421      6.969     -8.673      0.000     -74.210     -46.674
I(poa * w_vel)     2.9091     14.604      0.199      0.842     -25.942      31.761
==============================================================================
Omnibus:                        7.541   Durbin-Watson:                   0.795
Prob(Omnibus):                  0.023   Jarque-Bera (JB):                7.000
Skew:                          -0.454   Prob(JB):                       0.0302
Kurtosis:                       2.505   Cond. No.                     1.31e+04
==============================================================================

Notes:
[1] R² is computed without centering (uncentered) since the model does not contain a constant.
[2] Standard Errors assume that the covariance matrix of the errors is correctly specified.
[3] The condition number is large, 1.31e+04. This might indicate that there are
strong multicollinearity or other numerical problems.

Simulated Data

Data Plot

[9]:
tst.sim.plot(default_groups=['real_pwr__', 'irr_poa', 'temp_amb_', 'wind__'], width=1200)
/home/docs/checkouts/readthedocs.org/user_builds/pvcaptest/checkouts/latest/src/captest/plotting.py:117: UserWarning: More than one group found for regex string temp_amb_. Refine regex string to find only one group. Groups found: ['temp_amb_', 'temp_amb_bom']
  warnings.warn(
[9]:

Filtering Summary

[10]:
tst.sim.get_summary()
[10]:
function_name pts_after_filter pts_removed filter_arguments
pvsyst Time Time 721 8039 days=30, drop=False, test_date=10/11/1990
Irradiance Irradiance 114 607 high=930, low=400
Pvsyst Pvsyst 114 0 Default arguments
Irradiance-1 Irradiance 59 55 high=1.2, low=0.8, ref_val=810.1750741447345
[11]:
print(tst.sim.describe_filters())
Data outside a 30-day window centered on 1990-10-11 (1990-09-26 to 1990-10-26) was removed.
Intervals where e_total is below 400 or above 930 W/m^2 were removed.
PVsyst intervals operating off the maximum power point (IL Pmin/Vmin/Pmax/Vmax > 0) were removed.
Intervals where e_total is below 648.1400593157877 or above 972.2100889736813 W/m^2 were removed.

Filtering Vizualizations

[12]:
tst.sim.scatter_filters() + tst.sim.timeseries_filters().opts(width=1_000)
[12]:

Regression

[13]:
tst.sim.fit_regression()
                                 OLS Regression Results
=======================================================================================
Dep. Variable:                  power   R-squared (uncentered):                   1.000
Model:                            OLS   Adj. R-squared (uncentered):              1.000
Method:                 Least Squares   F-statistic:                          1.418e+06
Date:                Fri, 17 Jul 2026   Prob (F-statistic):                   3.86e-137
Time:                        21:21:04   Log-Likelihood:                         -647.65
No. Observations:                  59   AIC:                                      1303.
Df Residuals:                      55   BIC:                                      1312.
Df Model:                           4
Covariance Type:            nonrobust
==================================================================================
                     coef    std err          t      P>|t|      [0.025      0.975]
----------------------------------------------------------------------------------
poa             7155.6845     27.952    256.002      0.000    7099.668    7211.701
I(poa * poa)      -0.8113      0.029    -27.579      0.000      -0.870      -0.752
I(poa * t_amb)   -29.2335      0.596    -49.046      0.000     -30.428     -28.039
I(poa * w_vel)     0.1077      1.474      0.073      0.942      -2.847       3.063
==============================================================================
Omnibus:                        3.365   Durbin-Watson:                   1.616
Prob(Omnibus):                  0.186   Jarque-Bera (JB):                2.729
Skew:                          -0.404   Prob(JB):                        0.255
Kurtosis:                       2.323   Cond. No.                     9.49e+03
==============================================================================

Notes:
[1] R² is computed without centering (uncentered) since the model does not contain a constant.
[2] Standard Errors assume that the covariance matrix of the errors is correctly specified.
[3] The condition number is large, 9.49e+03. This might indicate that there are
strong multicollinearity or other numerical problems.

Results

The results of this test produced using the configuation yaml file (bifi_config.yaml) are identical to the example test notebook captest_class_bifi.ipynb that was used to produce the bifi_config.yaml.

Filtering Summary

[14]:
tst.get_summary()
[14]:
function_name pts_after_filter pts_removed filter_arguments
meas Custom Custom 1424 16 dropna()
Irradiance Irradiance 452 972 high=1400, low=400
Outliers Outliers 433 19 EllipticEnvelope(support_fraction=0.9, contami...
Regression Regression 405 28 n_std=2
RepCond RepCond 405 0 front_poa=poa, irr_bal=False, percent_filter=20
Irradiance-1 Irradiance 157 248 high=1.2, low=0.8, ref_val=810.1750741447345
pvsyst Time Time 721 8039 days=30, drop=False, test_date=10/11/1990
Irradiance Irradiance 114 607 high=930, low=400
Pvsyst Pvsyst 114 0 Default arguments
Irradiance-1 Irradiance 59 55 high=1.2, low=0.8, ref_val=810.1750741447345

Reporting Conditions

[15]:
tst.meas.rc
[15]:
poa t_amb w_vel
0 810.175074 25.142031 2.220261

Capacity Ratio and Regression Coefficients Summary

[16]:
tst.captest_results_check_pvalues(print_res=True)
Using reporting conditions from meas.

Capacity Test Result:    FAIL
Modeled test output:          4669588.394
Actual test output:           4323690.643
Tested output ratio:          0.926
Tested Capacity:              5555.553
Bounds:                       5820.0, 6180.0


Using reporting conditions from meas.

Capacity Test Result:    FAIL
Modeled test output:          4669394.721
Actual test output:           4410399.168
Tested output ratio:          0.945
Tested Capacity:              5667.200
Bounds:                       5820.0, 6180.0


92.590% - Cap Ratio
94.450% - Cap Ratio after pval check
[16]:
  das_pvals sim_pvals das_params sim_params
poa 0.00000 0.00000 6,963.39800 7,155.68453
I(poa * poa) 0.46574 0.00000 -0.14007 -0.81125
I(poa * t_amb) 0.00000 0.00000 -60.44211 -29.23354
I(poa * w_vel) 0.84237 0.94205 2.90915 0.10767