captest.CapTest

class captest.CapTest(**kwargs)

Config + state container for an ASTM E2848 capacity test.

CapTest binds a measured CapData and a modeled CapData to a named regression preset from TEST_SETUPS and holds all test-level configuration in one place. It is intentionally a config + state container rather than a runner: users still invoke ct.meas.filter_*(...), ct.meas.rep_cond(...), and ct.meas.fit_regression() by hand.

Typical workflows

  1. 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.
    
  2. From a yaml file:

    ct = CapTest.from_yaml("./config.yaml")
    
  3. 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 CapData instance. Assigned via from_params, from_yaml, or directly.

type meas:

CapData or None

param sim:

Modeled-data CapData instance.

type sim:

CapData or None

param test_setup:

Key into TEST_SETUPS or 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_cols dict.

type reg_cols_meas:

dict or None

param reg_cols_sim:

If set, overrides the preset’s modeled regression_cols dict.

type reg_cols_sim:

dict or None

param rep_conditions:

If set, partial-merged onto the preset’s rep_conditions at setup(). Top-level keys replace; the nested func dict 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.rc is used by captest_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 CapData instances at setup(). See _downstream_attrs.

type bifaciality:

float

param power_temp_coeff:

Calc-params scalars propagated onto both CapData instances at setup(). See _downstream_attrs.

type power_temp_coeff:

float

param base_temp:

Calc-params scalars propagated onto both CapData instances at setup(). See _downstream_attrs.

type base_temp:

float

param meas_loader:

Programmatic-only data-loader callables. Default resolution when None: captest.io.load_data and captest.io.load_pvsyst respectively. 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_data and captest.io.load_pvsyst respectively. 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_SETUPS entry after setup() has run. Plain instance attribute (not a param.*) so setup() 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, when rep_irr_filter=0.2 this is 0.8. Pass as low to CapData.filter_irr together with a ref_val.

Type:

float

rep_irr_filter_high

Read-only. Upper irradiance fraction bound derived from rep_irr_filter: 1 + rep_irr_filter. For example, when rep_irr_filter=0.2 this is 1.2. Pass as high to CapData.filter_irr together with a ref_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.meas vs self.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.

get_summary()

Concatenate self.meas.get_summary() and self.sim.get_summary().

overlay_scatters([expected_label])

Overlay the final scatter plot from self.meas and self.sim.

rep_cond([which])

Call cd.rep_cond with the resolved preset's rep_conditions.

residual_plot()

Overlayed residual plots for self.meas and self.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

ac_nameplate

base_temp

bifaciality

clipping_irr

fshdbm

hrs_req

irrad_stability

irrad_stability_threshold

max_irr

meas

meas_load_kwargs

meas_loader

min_irr

name

param

power_temp_coeff

reg_cols_meas

reg_cols_sim

reg_fml

rep_cond_source

rep_conditions

rep_irr_filter

rep_irr_filter_high

Upper irradiance fraction bound derived from rep_irr_filter.

rep_irr_filter_low

Lower irradiance fraction bound derived from rep_irr_filter.

resolved_setup

Return the resolved TEST_SETUPS entry or raise if setup() not run.

shade_filter_end

shade_filter_start

sim

sim_days

sim_load_kwargs

sim_loader

spectral_module_type

test_setup

test_tolerance