-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove duplicate times from Tamborra, Walk models #161
Conversation
Once this is merged into SNEWPY, SNEWS2/sntools#40 will add support for these models to sntools. |
This looks like insufficient time precision in the simulation output script. |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these changes look fine except for models/Tamborra_2014/s27.0c_3D_dir1_LS220_nux
where a large number of lines were deleted. Those do not appear to be duplicates so it's not obvious why this was done.
Ouch 😣 not sure how that happened; thanks for noticing it! |
Result of Benchmark Tests
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for restoring the deleted fluxes, this looks ready to go.
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.