Closed JostMigenda closed 2 years ago
Once this is merged into SNEWPY, JostMigenda/sntools#40 will add support for these models to sntools.
This looks like insufficient time precision in the simulation output script. Would it make sense to add such cleanup when we read the models, so if we later have more models from the Garching group, we don't have to manually clean them up?
I think I’d prefer it if a human takes a look at any such issue in the input file, as a sanity check; to confirm whether it’s actually just numerical noise like here or whether there’s a more serious issue.
Plus, if we publish model files it’s always gonna be possible that someone wants to use them independently of SNEWPY, so eliminating the problem at the root instead of fixing it in snewpy.models
would be safer.
Ouch 😣 not sure how that happened; thanks for noticing it! I have a meeting now but can fix that tomorrow.
Benchmark | Min | Max | Mean |
---|---|---|---|
python/snewpy/test/test_snowglobes.py::test_simulation_chain_benchmark | 4.70 | 4.79 | 4.74 +- 0.04 |
For future reference, here’s a quick script to remove duplicates:
filename = 'models/Walk_2019/s40.0c_3DBH_dir1_LS220_nue'
fin = open(filename, 'r')
fout = open(filename+'_mod', 'w')
prev_t = -1
for line in fin:
this_t = float(line.split()[0])
if this_t <= prev_t:
print(f"Deleted duplicate line at t={this_t}")
else:
fout.write(line)
prev_t = this_t
Input files for the
Tamborra_2014
,Walk_2018
andWalk_2019
models had multiple lines for certain times; either complete duplicates or with negligible numerical differences.This trips up some algorithms (e.g.
scipy.interpolate.pchip
raisesValueError: 'x' must be strictly increasing sequence.
), so this PR deletes those duplicate times.