captest.CapTest
- class captest.CapTest(**kwargs)
Config + state container for an ASTM E2848 capacity test.
CapTestbinds a measuredCapDataand a modeledCapDatato a named regression preset fromTEST_SETUPSand holds all test-level configuration in one place. It is intentionally a config + state container rather than a runner: users still invokect.meas.filter_*(...),ct.meas.rep_cond(...), andct.meas.fit_regression()by hand.Typical workflows
Programmatic:
ct = CapTest.from_params( test_setup="e2848_default", meas=meas_cd, sim=sim_cd, ac_nameplate=125_000, test_tolerance="- 4", ) # ``from_params`` runs ``setup()`` automatically because both meas # and sim were supplied as pre-built CapData instances.
From a yaml file:
ct = CapTest.from_yaml("./config.yaml")
Bare + manual:
ct = CapTest(test_setup="bifi_e2848_etotal", bifaciality=0.15) ct.meas = my_meas_cd ct.sim = my_sim_cd ct.setup()
- param meas:
Measured-data
CapDatainstance. Assigned viafrom_params,from_yaml, or directly.- type meas:
CapData or None
- param sim:
Modeled-data
CapDatainstance.- type sim:
CapData or None
- param test_setup:
Key into
TEST_SETUPSor the literal"custom". Default"e2848_default".- type test_setup:
str
- param reg_fml:
If set, overrides the preset’s regression formula at
setup().- type reg_fml:
str or None
- param reg_cols_meas:
If set, overrides the preset’s measured
regression_colsdict.- type reg_cols_meas:
dict or None
- param reg_cols_sim:
If set, overrides the preset’s modeled
regression_colsdict.- type reg_cols_sim:
dict or None
- param rep_conditions:
If set, partial-merged onto the preset’s
rep_conditionsatsetup(). Top-level keys replace; the nestedfuncdict is merged one level deep so users can override only a single variable’s aggregation.- type rep_conditions:
dict or None
- param rep_cond_source:
Which
CapData.rcis used bycaptest_results. Default"meas".- type rep_cond_source:
{“meas”, “sim”}
- param sim_days:
Days of simulated data used for the test. Default 30.
- type sim_days:
int
- param shade_filter_start:
"HH:MM"between-time strings for shade filtering.- type shade_filter_start:
str or None
- param shade_filter_end:
"HH:MM"between-time strings for shade filtering.- type shade_filter_end:
str or None
- param ac_nameplate:
Nameplate AC power in watts.
- type ac_nameplate:
float or None
- param test_tolerance:
Tolerance string forwarded to pass/fail logic. Default
"- 4".- type test_tolerance:
str
- param min_irr:
Irradiance filter bounds (W/m^2).
- type min_irr:
float
- param max_irr:
Irradiance filter bounds (W/m^2).
- type max_irr:
float
- param clipping_irr:
Irradiance filter bounds (W/m^2).
- type clipping_irr:
float
- param rep_irr_filter:
Fractional reporting-irradiance filter band in
[0, 1].- type rep_irr_filter:
float
- param fshdbm:
Shade filter threshold in
[0, 1].- type fshdbm:
float
- param irrad_stability:
Irradiance stability strategy.
- type irrad_stability:
{“std”, “filter_clearsky”, “contract”}
- param irrad_stability_threshold:
Threshold value for
irrad_stability.- type irrad_stability_threshold:
float
- param hrs_req:
Hours of data required for a complete test. Default 12.5.
- type hrs_req:
float
- param bifaciality:
Calc-params scalars propagated onto both
CapDatainstances atsetup(). See_downstream_attrs.- type bifaciality:
float
- param power_temp_coeff:
Calc-params scalars propagated onto both
CapDatainstances atsetup(). See_downstream_attrs.- type power_temp_coeff:
float
- param base_temp:
Calc-params scalars propagated onto both
CapDatainstances atsetup(). See_downstream_attrs.- type base_temp:
float
- param meas_loader:
Programmatic-only data-loader callables. Default resolution when
None:captest.io.load_dataandcaptest.io.load_pvsystrespectively. Not serialized to yaml.- type meas_loader:
callable or None
- param sim_loader:
Programmatic-only data-loader callables. Default resolution when
None:captest.io.load_dataandcaptest.io.load_pvsystrespectively. Not serialized to yaml.- type sim_loader:
callable or None
- param meas_load_kwargs:
Plain-dict kwargs splatted into the loaders.
- type meas_load_kwargs:
dict or None
- param sim_load_kwargs:
Plain-dict kwargs splatted into the loaders.
- type sim_load_kwargs:
dict or None
- _resolved_setup
The fully-resolved
TEST_SETUPSentry aftersetup()has run. Plain instance attribute (not aparam.*) sosetup()can be called multiple times.- Type:
dict or None
- rep_irr_filter_low
Read-only. Lower irradiance fraction bound derived from
rep_irr_filter:1 - rep_irr_filter. For example, whenrep_irr_filter=0.2this is0.8. Pass aslowtoCapData.filter_irrtogether with aref_val.- Type:
float
- rep_irr_filter_high
Read-only. Upper irradiance fraction bound derived from
rep_irr_filter:1 + rep_irr_filter. For example, whenrep_irr_filter=0.2this is1.2. Pass ashightoCapData.filter_irrtogether with aref_val.- Type:
float
Notes
The lhs key of the regression formula is always
"power"across shipped presets, even when the formula regresses a derived quantity (e.g. temperature-corrected power).- __init__(**kwargs)
Methods
__init__(**kwargs)captest_results([check_pvalues, pval, print_res])Compute the capacity test ratio for
self.measvsself.sim.captest_results_check_pvalues([print_res])Compute cap ratio with and without p-value filtering.
determine_pass_or_fail(cap_ratio)Determine a pass/fail result from a capacity ratio.
from_mapping(sub, *[, key, base_dir, ...])Construct a CapTest from an already-parsed captest sub-mapping.
from_params(**kwargs)Construct a CapTest from parameter kwargs.
from_yaml(path[, key, meas_loader, sim_loader])Construct a CapTest from a yaml config file.
Concatenate
self.meas.get_summary()andself.sim.get_summary().overlay_scatters([expected_label])Overlay the final scatter plot from
self.measandself.sim.rep_cond([which])Call
cd.rep_condwith the resolved preset's rep_conditions.Overlayed residual plots for
self.measandself.sim.scatter_plots([which])Create the scatter plot for the active capacity-test setup.
setup([verbose])Resolve TEST_SETUPS, propagate scalars, process regression cols.
to_yaml(path[, key, merge_into_existing])Serialize the curated CapTest configuration to a yaml file.
Attributes
paramUpper irradiance fraction bound derived from
rep_irr_filter.Lower irradiance fraction bound derived from
rep_irr_filter.Return the resolved TEST_SETUPS entry or raise if setup() not run.