-
Notifications
You must be signed in to change notification settings - Fork 4
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
Repetition #43
Repetition #43
Conversation
@@ -0,0 +1,98 @@ | |||
""" |
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.
I'm assuming this code in Obsolete
need
not be reviewed. But let me know if that's
not right.
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.
This is true. Obsolete is for files which may in theory be useful, so I don't want them deleted; but they have no direct relevance to the analysis, so they're kept out of the way.
import matplotlib | ||
import time | ||
from zdm import beams | ||
beams.beams_path = '/Users/cjames/CRAFT/FRB_library/Git/H0paper/papers/Repeaters/BeamData/' |
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.
here and throughout, can we avoid hard-coding paths?
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.
Yep, I thought I had removed all of these, but clearly not! All done now. Actually, most of this was obsolete stuff I just hadn't deleted...
@@ -0,0 +1,446 @@ | |||
""" |
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.
please move this under zdm
, e.g. in a folder named chime
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.
same comment for any of the code in this current folder that would be needed by others to do "simple" CHIME analyses
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.
It's not needed for simple CHIME analysis - originally, yes it was, but not anymore! See file zdm/scripts/load_chime_data.py
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.
i.e. the file is staying where it is :-)
zdm/repeat_grid.py
Outdated
p2no_reps = np.exp(-N2reps) | ||
|
||
|
||
def poisson_z(Robs,*args): |
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.
move this code elsewhere?
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.
Moved to the recycle bin - I'd honestly forgotten this was in there, it's a relic from a first attempt at an analytic calculation. So deleted.
zdm/repeat_grid.py
Outdated
|
||
|
||
|
||
def calc_p_rep(Cr,V): |
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.
move this code elsewhere?
e.g. repeater_utils.py
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.
Also legacy code, now deleted
zdm/scripts/repeaters.py
Outdated
@@ -0,0 +1,191 @@ | |||
""" | |||
This script creates zdm grids and plots localised FRBs |
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.
I assume this doc is incorrect. Please update
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.
Yes, indeed it is - I'd forgotten about this, this file is now updated in several ways
zdm/survey.py
Outdated
if self.NFRB==0: | ||
raise ValueError('No FRBs found in file '+filename) #change this? | ||
|
||
#if self.NFRB==0: |
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.
rm this code
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.
actually, this is OldSurvey
we should not be using this anymore, right?
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.
Correct, we shouldn't be using it. Maybe we shortly shift this to a separate "old_survey.py" file, to make development easier? However, I had to change this, since it's vital to allow surveys to have no FRBs in them. So I'll keep this code there, but we can discuss what to do about old_survey. I think we need to keep the code for posterity, but maybe shift it somewhere? Or I guess, this is what version control is for. Once we are 100% sure we have converted over all old .dat files, then we delete
zdm/survey.py
Outdated
@@ -32,7 +32,6 @@ class Survey: | |||
|
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.
Just realized here that this branch has not pulled in main
yet,
so I am going to stop reviewing until we do.
@cwjames1983 -- I was aiming to generate
But the file |
No idea why the remote was changed, but merging before pushing changes...
from zdm import beams | ||
|
||
|
||
beams.beams_path = '/Users/cjames/CRAFT/FRB_library/Git/H0paper/papers/Repeaters/BeamData/' |
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.
are these the same files as in zdm/papers/Repeaters/BeamData/
?
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.
Yes, and this is an old pathname, now deprecated and removed. Files now shifted to zdm/data/BeamData/CHIME/
zdm/iteration.py
Outdated
const *= factor | ||
return const | ||
|
||
def OldConvertToMeaningfulConstant(pset): |
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.
remove?
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.
Removed!
|
||
self.calc_Rthresh(Exact=Exact,MC=MC,doplots=doplots) | ||
|
||
def update(self,Rmin = None,Rmax = None,Rgamma = None): |
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.
define Rmin, Rmax, Rgamma
in doc string
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.
Done
return Rc,Ntot | ||
|
||
|
||
def calc_Rthresh(self,Exact=True,MC=False,Pthresh=0.01,doplots=False,old=[False,False,False]): |
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.
explain what Exact
does
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.
Done
from zdm import survey | ||
from matplotlib import pyplot as plt | ||
|
||
def main(): |
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.
I don't think this script does much of anything.
Remove this file?
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.
You are correct - I've now updated it to be useful
@@ -88,7 +84,8 @@ def get_efficiency_from_wlist(self,DMlist,wlist,plist, | |||
""" | |||
efficiencies=np.zeros([wlist.size,DMlist.size]) | |||
if addGalacticDM: | |||
toAdd = self.DMhalo + np.mean(self.DMGs) | |||
# the following is safe against surveys with zero FRBs |
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.
How many of these changes need to propogate to the new Survey
class?
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.
I've now fully debugged the new survey class to be robust against surveys with 0 and >0 FRBs. The methods are quite different in the new survey class.
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.
Ok, finished a careful and comprehensive pass
…etition files to standard location
…hanges to plotting scripts for Repeaters paper.
@@ -1,7 +1,14 @@ | |||
""" | |||
This script creates zdm grids and plots localised FRBs | |||
This script shows how to use repeating FRB grids. |
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.
I tried running this script, but it fails right away.
@@ -5,6 +5,9 @@ | |||
It simply loads in CHIME data and makes sure | |||
everything can be read correctly. | |||
|
|||
It also demonstrates how to generate "repeat grids" |
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.
I commented out 2 items that weren't used (and were causing my run to crash)
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.
after that, 3 lovely plots were generated in a CHIME/ folder! :)
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.
got the load_chime_data.py
script to run successfully
with sensible looking figures generated.
I'm convinced this is ready
This is a pretty large PR for FRB repetition behaviour!
It's composed of four components:
The current major issue with this is that it uses the old survey files, since I began this before the survey class was updated.
Hence, what I propose is to accept this PR, merge it with the main code, then I get a new clean checkout, and update all analyses to the new format (this won't be done urgently however, so maybe I just rename everything "old"?)