SNEWS2 / snewpdag

SNEWS2 alert calculations
BSD 3-Clause "New" or "Revised" License
2 stars 13 forks source link

Neutrino arrival time #42

Closed chensihan1999 closed 3 years ago

chensihan1999 commented 3 years ago

Added a data file titled "detector location.csv" containing detector latitude, longitude, height, and time uncertainty. Added "NeutrinoArrivalTime.py" that generates the true neutrino arrival time for a list of detectors. Added "TimeOffset.py" that adds a Gaussian noise to the generated true neutrino arrival time of detectors in the payload.

tsengj10 commented 3 years ago

Instead of using string manipulation to detect the overflow of the ns field, one might do the following:

  1. normalize both times, i.e., make sure the ns field has values between 0 and 999999999 (inclusive), adjusting the sec fields appropriately; the absolute times should remain the same, just with the ns field in the proper range
  2. subtract to get the time difference
  3. now we know there's a limit to how big the difference in the ns fields is, so we can increment or decrement the difference in the sec field accordingly (basically, normalize the time difference just as you did for the absolute times in step 1)
tsengj10 commented 3 years ago

Also it's a pretty common thing in csv files for the first row to contain column titles. You do something close to this, but instead of depending on the fact that the first column in the first row is blank, you can also just explicitly ignore the contents of the first row. (I imagine it's a pretty easy mistake to make, to leave a detector name blank somewhere, in which case I think your code will pick up the contents of that first row)

chensihan1999 commented 3 years ago

Instead of using string manipulation to detect the overflow of the ns field, one might do the following:

  1. normalize both times, i.e., make sure the ns field has values between 0 and 999999999 (inclusive), adjusting the sec fields appropriately; the absolute times should remain the same, just with the ns field in the proper range
  2. subtract to get the time difference
  3. now we know there's a limit to how big the difference in the ns fields is, so we can increment or decrement the difference in the sec field accordingly (basically, normalize the time difference just as you did for the absolute times in step 1)
chensihan1999 commented 3 years ago

I've updated the portion of the code where I normalize both the s and the ns fields.

chensihan1999 commented 3 years ago

I've replaced the old normalizing time code with the normlized_time function in the lib.py file.