Tests and checks#
Functions for checking that the inference model is working correctly.
Master function (calls each of the functions in the |
|
Check that stratigraphic superposition between all age constriants and samples is respected in the posterior. |
|
Check that detrital age constraints have been enforced in the posterior. |
|
Check that intrusive age constraints have been enforced in the posterior. |
- stratmc.tests.check_detrital_ages(full_trace, sample_df, ages_df, quiet=True, **kwargs)[source]#
Check that detrital age constraints have been enforced in the posterior.
- Parameters:
- full_trace: arviz.InferenceData
An
arviz.InferenceDataobject containing the full set of prior and posterior samples fromget_trace()instratmc.inference.- sample_df: pandas.DataFrame
pandas.DataFramecontaining proxy data for all sections.- ages_df: pandas.DataFrame
pandas.DataFramecontaining age constraints for all sections.- sections: list(str) or numpy.array(str), optional
List of sections included in the inference. Defaults to all sections in
sample_df.- quiet: bool, optional
Whether to print the section name and chain/draw of each superposition violation; defaults to
False.
- Returns:
- bad_chains: numpy.array
Array of chain indices where superposition was violated in the posterior.
- stratmc.tests.check_inference(full_trace, sample_df, ages_df, quiet=True, **kwargs)[source]#
Master function (calls each of the functions in the
testsmodule) for checking that superposition is never violated in the posterior. Returns a list of chain indices where superposition was violated; these chains can be dropped from the trace usingdrop_chains(). Run automatically inside ofget_trace()instratmc.inference.Because of the likelihood penalty used to manually enforce detrital and intrusive ages in
intermediate_detrital_potential()andintermediate_intrusive_potential()(called inbuild_model()), rare chains may have minor superposition violations when deterital/intrusive ages are present. These chains can simply be discarded. If superposition is frequently violated in a given section, or if superposition violations are severe, check that the heights for all age constraints inages_dfare correct, and that the reported ages respect superposition. The model can correct for mean ages that are out of superposition, but may fail if the age constraints do not overlap given their 2$sigma$ uncertainties.- Parameters:
- full_trace: arviz.InferenceData
An
arviz.InferenceDataobject containing the full set of prior and posterior samples fromget_trace()instratmc.inference.- sample_df: pandas.DataFrame
pandas.DataFramecontaining proxy data for all sections.- ages_df: pandas.DataFrame
pandas.DataFramecontaining age constraints for all sections.- sections: list(str) or numpy.array(str), optional
List of sections included in the inference. Defaults to all sections in
sample_df.- quiet: bool, optional
Whether to print the type, section name, and chain/draw of each superposition violation; defaults to
False.
- Returns:
- bad_chains: numpy.array
Array of chain indices where superposition was violated in the posterior.
- stratmc.tests.check_intrusive_ages(full_trace, sample_df, ages_df, quiet=True, **kwargs)[source]#
Check that intrusive age constraints have been enforced in the posterior.
- Parameters:
- full_trace: arviz.InferenceData
An
arviz.InferenceDataobject containing the full set of prior and posterior samples fromget_trace()instratmc.inference.- sample_df: pandas.DataFrame
pandas.DataFramecontaining proxy data for all sections.- ages_df: pandas.DataFrame
pandas.DataFramecontaining age constraints for all sections.- sections: list(str) or numpy.array(str), optional
List of sections included in the inference. Defaults to all sections in
sample_df.- quiet: bool, optional
Whether to print the section name and chain/draw of each superposition violation; defaults to
False.
- Returns:
- bad_chains: numpy.array
Array of chain indices where superposition was violated in the posterior.
- stratmc.tests.check_superposition(full_trace, sample_df, ages_df, quiet=True, **kwargs)[source]#
Check that stratigraphic superposition between all age constriants and samples is respected in the posterior.
- Parameters:
- full_trace: arviz.InferenceData
An
arviz.InferenceDataobject containing the full set of prior and posterior samples fromget_trace()instratmc.inference.- sample_df: pandas.DataFrame
pandas.DataFramecontaining proxy data for all sections.- ages_df: pandas.DataFrame
pandas.DataFramecontaining age constraints for all sections.- sections: list(str) or numpy.array(str), optional
List of sections included in the inference. Defaults to all sections in
sample_df.- quiet: bool, optional
Whether to print the section name and chain/draw of each superposition violation; defaults to
False.
- Returns:
- bad_chains: numpy.array
Array of chain indices where superposition was violated in the posterior.