Skip to content

Saving new measurement  #147

Description

@dlanci

Dear mantainers,

Apologies in advance if what I'm about to ask is detailed in some guide but I couldn't find it anywhere. I would like to create a new measurement instance modifying one of the existing ones in flavio. For example, for the relevant observables I want to create an arbitrary Likelihood:

obs_space=np.linspace(0.5,1.5,1001)
logL=normal_logpdf(obs_space, 1., 0.04)
plt.plot(obs_space,np.exp(logL-logL.max()))

Then from the file measurements_test.yml that contains a dictionary that is the copy of the observable I want to edit I do:

with open('/path/to/flavio/data/measurements_test.yml') as file:

    test = yaml.load(file, Loader=yaml.FullLoader)

test2=copy.deepcopy(test)
test2['observable']['values'][0]['value']['y']=np.exp(logL)

When I want to save I do:

flavio.measurements.write_file('/path/to/flavio/data/measurements_test_1.yml',test2)

And I obtain a key error

KeyError: 'observable'

What am I missing in the definition of the measurement instance with these steps?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions