Posterior

class rocky_worlds_data_challenge.Posterior(samples: ArrayLike, parameter_keys: ArrayLike)[source]

Bases: object

Posterior samples and parameter names for one planet.

Variables:
  • samples (array-like) – Posterior samples with shape (n_parameters, n_samples).

  • parameter_keys (array-like) – Names corresponding to each row of samples. Keys are normalized to a flat list of Python strings.

Normalize inputs and validate the posterior sample table.

Parameters:
  • samples (array-like) – Posterior samples with shape (n_parameters, n_samples).

  • parameter_keys (array-like) – Names corresponding to each row of samples.

Raises:

ValueError – If the posterior samples or parameter keys fail validation.

Attributes Summary

parameter_keys

Names corresponding to each row of samples.

samples

Posterior samples with shape (n_parameters, n_samples).

Methods Summary

load([filepath, posterior_filepath])

Load one posterior table from a submission ZIP archive.

validate()

Check posterior shape, sample count, and eclipse-depth values.

Attributes Documentation

parameter_keys: ArrayLike

Names corresponding to each row of samples.

samples: ArrayLike

Posterior samples with shape (n_parameters, n_samples).

Methods Documentation

classmethod load(filepath='submission.zip', posterior_filepath='posterior_LHS1140b.txt')[source]

Load one posterior table from a submission ZIP archive.

Parameters:
  • filepath (path-like, optional) – Path to the submission ZIP archive.

  • posterior_filepath (str, optional) – Name of the posterior text file inside filepath.

Returns:

Posterior object loaded from the CSV-formatted text file.

Return type:

Posterior

validate()[source]

Check posterior shape, sample count, and eclipse-depth values.

Raises:
  • ValueError – If the sample array orientation, parameter-key count, sample count, required depth_ecl key, or depth_ecl values are invalid.

  • UserWarning – If the posterior has fewer than the recommended number of samples but still has enough samples to construct a submission.