Experiment#
- class Experiment(pars=None, flags=None, label=None, **kwargs)[source]#
Bases:
prettyobj
Class for running calibration to data. Effectively, it runs a single sim and compares it to data.
- Parameters:
pars (dict) – dictionary of parameters
flags (dict) – which analyses to run; see
fp.experiment.default_flags
for optionslabel (str) – label of experiment
kwargs (dict) – passed into pars
Methods
- post_process_results(keep_people=False, compute_fit=True, **kwargs)[source]#
Compare the model and the data
- run(pars=None, keep_people=False, compute_fit=True, **kwargs)[source]#
Run the model and post-process the results
- summarize(as_df=False)[source]#
Convert results to a one-number-per-key summary format. Returns summary, also saves to self.summary.
- Parameters:
as_df (bool) – if True, return a dataframe instead of a dict.
- to_json(filename=None, tostring=False, indent=2, verbose=False, **kwargs)[source]#
Export results as JSON.
- Parameters:
filename (str) – if None, return string; else, write to file
tostring (bool) – if not writing to file, whether to write to string (alternative is sanitized dictionary)
indent (int) – if writing to file, how many indents to use per nested level
verbose (bool) – detail to print
kwargs (dict) – passed to savejson()
- Returns:
A unicode string containing a JSON representation of the results, or writes the JSON file to disk
Examples:
json = exp.to_json() exp.to_json('results.json')