Skip to content
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

Repeated time entries in Walk_2019 nu_e_bar file #210

Closed
sgriswol opened this issue Sep 19, 2022 · 0 comments · Fixed by #211
Closed

Repeated time entries in Walk_2019 nu_e_bar file #210

sgriswol opened this issue Sep 19, 2022 · 0 comments · Fixed by #211

Comments

@sgriswol
Copy link
Contributor

The nu_e_bar table loaded for the Walk_2019 model contains duplicate entries for the times listed below. Column 1 is the time in s, column 2 is the index in the Walk_2019.time member. This was found by running the model through scipy.interpolate.PchipInterpolator, using model.time as the argument x.

This only features in the nu_e_bar file, and appears to have been resolved for other flavors by commit 1e37a4c

https://github.com/SNEWS2/snewpy/blob/main/models/Walk_2019/s40.0c_3DBH_dir1_LS220_nuebar

Code to replicate & find duplicate entries

from snewpy.models.ccsn import Walk_2019
from snewpy.neutrino import Flavor
from scipy.interpolate import PchipInterpolator
import numpy as np

model = Walk_2019(filename='<path-to-snewpy-models>/Walk_2019/s40.0c_3DBH_dir1')
time = model.time

try:
    interp_lum = PchipInterpolator(x=time, y=model.luminosity[Flavor.NU_E_BAR])
except ValueError as e:
    print(e)

diff = np.diff(time)
idx = np.where(diff==0)[0]
print(f"{'time':<10s} {'idx':<5s}")
for t, i in zip(time[idx], idx):
    # Add +1 to index to point at duplicate entries
    print(f"{t.value:<10f} {i+1:<5d}") 

Expected Output

`x` must be strictly increasing sequence.
time       idx  
0.110000   202  
0.177700   339  
0.199450   384  
0.227050   441  
0.298840   586  
0.299840   589  
0.300840   592  
0.317840   627  
0.340850   675  
0.340850   676  
0.360000   716  
0.379800   757  
0.388780   776  
0.410860   822  
0.435360   872  
0.435360   873  
0.454740   913  
0.479720   964  
0.500000   1006 
0.521940   1051 
0.526970   1063 
0.527320   1065 
0.531420   1075 
0.560410   1134 
0.563570   1142 
0.570090   1157 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant