SWIFTSIM / emulator

The SWIFT simulation cosmological emulator (swift-emulator)
GNU Lesser General Public License v3.0
5 stars 2 forks source link

Add a 1d emulator to emulate single values #26

Closed Moyoxkit closed 2 years ago

Moyoxkit commented 3 years ago

Added for completion, might be useful for emulating fitting variables.

There are a few quirks due to the fact that everything is designed around scaling relations.

The main issue is found with the model_values that are inserted. Some of the checks require the inputs to be arrays, while for a 1D emulator these are always single values. Also while no values for the independent are used, it does still require something to be filled in (but None works)

Example of a ModelValues container that works:

modelvalues = {}
for unique_identifier in range(100):
    dependent = func(a_arr[unique_identifier], b_arr[unique_identifier])
    dependent_error = 0.02 * dependent
    modelvalues[unique_identifier] = {"independent": [None],
                                      "dependent": [dependent],
                                    "dependent_error": [dependent_error]}

As this is experimental anyway it shouldn't be a massive problem to leave it like this, but it should be easy to create a separate model_values container just for these 1D emulations.

JBorrow commented 2 years ago

Needs docs then we can merge

Moyoxkit commented 2 years ago

Should be ready now