How to use the astromodels.core.my_yaml.my_yaml.dump function in astromodels

To help you get started, we’ve selected a few astromodels examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github threeML / threeML / threeML / analysis_results.py View on Github external
samples = np.zeros(n_parameters)

        else:

            assert isinstance(analysis_results, BayesianResults)

            # Empty covariance matrix

            covariance_matrix = np.zeros(n_parameters)

            # Gather the samples
            samples = analysis_results._samples_transposed

        # Serialize the model so it can be placed in the header

        yaml_model_serialization = my_yaml.dump(optimized_model.to_dict_with_types())

        # Replace characters which cannot be contained in a FITS header with other characters
        yaml_model_serialization = _escape_yaml_for_fits(yaml_model_serialization)

        # Get data frame with parameters (always use equal tail errors)

        data_frame = analysis_results.get_data_frame(error_type="equal tail")

        # Prepare columns

        data_tuple = [('NAME', free_parameters.keys()),
                      ('VALUE', data_frame['value'].values),
                      ('NEGATIVE_ERROR', data_frame['negative_error'].values),
                      ('POSITIVE_ERROR', data_frame['positive_error'].values),
                      ('ERROR', data_frame['error'].values),
                      ('UNIT', np.array(data_frame['unit'].values, str)),