SWIFTSIM / velociraptor-python

Python tools for using velociraptor catalogues, with SWIFT integration
GNU Lesser General Public License v3.0
0 stars 8 forks source link

Box size correction #87

Closed bwvdnbro closed 2 years ago

bwvdnbro commented 2 years ago

First draft of a new mechanism to add a correction to catalogue values in pipeline plots to correct for box size effects.

The idea is that the user specifies an additional box_size_correction argument in the autoplotter config file, which points to a file that contains correction values (format still to be decided). This is then used to initialise an object that has a correction function that is applied to the plot data before it is plotted.

@EvgeniiChaikin I will expand on this tomorrow, but this is what I had in mind.

bwvdnbro commented 2 years ago

@EvgeniiChaikin I have implemented the feature we discussed. This repository now has an additional script (velociraptor-compute-box-size-correction) that takes two pipeline output data*.yml files, the name of a plot and the corresponding plot type, and generates a .yml file with a correction. That correction file can then be used as the box_size_correction argument for a plot in the autoplotter config file.

I have created matching branches in the pipeline and pipeline-configs repositories and set up a small example that is based on two runs of one of your waves (so not very realistic). Can you give this a try?

bwvdnbro commented 2 years ago

The extrapolation outside the range was definitely going very wrong, so I have adapted the script to only use the range present in both datasets. The range limits are now also written to the correction .yml file and are used in the autoplotter correction function. Outside the range, the correction is simply set to 1.

Using a linear versus a cubic spline makes little difference within the range in all my tests, so I have just kept that as it is. But if you think linear interpolation is better, that is very easy to change.

EvgeniiChaikin commented 2 years ago

If cubic vs. linear makes little difference, maybe we could indeed leave everything as is.

I re-created my plot attached above, now for the updated version of the branch. The strange behavior of the black dashed curve at the right boundary is gone.

text