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
Review for DM-10253: make obs_ctio0m9 work #4
Conversation
from lsst.obs.ctio0m9 import Ctio0m9 | ||
|
||
class Ctio0m9MakeRawVisitInfo(MakeRawVisitInfo): | ||
"""functor to make a VisitInfo from the FITS header of a raw image | ||
""" | ||
|
||
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.
White space only change.
def setArgDict(self, md, argDict): | ||
"""Fill an argument dict with arguments for makeVisitInfo and pop associated metadata | ||
""" | ||
super(Ctio0m9MakeRawVisitInfo, self).setArgDict(md, argDict) | ||
argDict["darkTime"] = md.get("DARKTIME") | ||
#The line above should maybe be moved to obs_base/makeRawVisitInfo.setArgDict() and read: |
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.
If you think it should be moved there, can you file a ticket to that effect please?
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.
Filed, see DM-10944. Comment removed.
"""Hook to retrieve number of bits in identifier for CCD""" | ||
return 32 | ||
|
||
def std_raw_md(self, md, dataId): |
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.
As stated in the ticket, I think this should actually call the same free function that translate_taiDate
uses so that we do not need the change to pipe_tasks
.
python/lsst/obs/ctio0m9/ingest.py
Outdated
@@ -107,7 +168,15 @@ def _translateFromCalibId(self, field, md): | |||
return match.groups()[0] | |||
|
|||
def translate_filter(self, md): | |||
print('\nMerlin says there might be a problem here\nCheck what is happening when you see this\n') |
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 should be a {{log.warn}} message. And maybe include the commented information below.
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 should never have been left in! This was just a note-to-self, and has been removed. Apologies.
scripts/pre_ingest_sanitisation.py
Outdated
################################# | ||
# Set these two variables, then rest should run: | ||
source_path = '/nfs/lsst2/photocalData/data/ctio0m9/' | ||
dest_root_path = '/nfs/lsst2/photocalData/data/ctio0m9_sanitised/' |
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 would be much better as arguments using argparse
scripts/pre_ingest_sanitisation.py
Outdated
@@ -0,0 +1,236 @@ | |||
# For an annotated version, use the ipython notebook. |
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 worried about keeping things in sync. If this is not auto generated from the ipynb, it could easily drift away from what is in there.
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, I made this myself because I thought that having it only exist as an IPython notebook might make people sad, so I made this for convenience, but I take your point about only having one. Given that I find having it as a notebook very useful for future poking I'm going to just delete the script.
scripts/pre_ingest_sanitisation.py
Outdated
headers[filename] = main_header | ||
if i%500==0: print 'loaded %s of %s'%(i, nfiles) | ||
|
||
print 'Finished loading headers' |
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.
If you are sanitizing headers here too, is it reasonable to fix the dates here?
Oh I guess you don't want to modify the files?
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.
O.K. I'm back to my first question. If you are messing with the files on disk that are actually processed, why not just make sure the dates are sane in the files you process? That would mean the sanitization code only lives in one place.
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 think we have to come up with an alternate solution to the observation date sanitization. I'd be happy with either doing it in pre-ingest or include it in both the ingest translator and in std_raw_md
. If the latter, it needs to only appear in one place.
scripts/pre_ingest_sanitisation.py
Outdated
|
||
dt = dafBase.DateTime(date_obs, dafBase.DateTime.TAI) | ||
mjd = dt.get(dafBase.DateTime.MJD) # MJD is actually the default | ||
mmjd = mjd - 55197 # relative to 2010-01-01, just to make the visits a tiny bit smaller |
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 seems arbitrary and makes the visits numbers carry less information. If you are going to change the zernpoint, why not change to something closer to the beginning of observations? Aren't these data all taken the last year or so?
scripts/pre_ingest_sanitisation.py
Outdated
this_header = this_file[0].header | ||
old_object = this_header['OBJECT'] | ||
if old_object in conversion.keys(): | ||
# print 'would have changed %s to %s'%(old_object, conversion[old_object]) |
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 prefer not to see commented out code.
scripts/pre_ingest_sanitisation.py
Outdated
headers[filename] = main_header | ||
if i%500==0: print 'loaded %s of %s'%(i, nfiles) | ||
|
||
print 'Finished loading headers' |
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.
O.K. I'm back to my first question. If you are messing with the files on disk that are actually processed, why not just make sure the dates are sane in the files you process? That would mean the sanitization code only lives in one place.
scripts/pre_ingest_sanitisation.py
Outdated
TZ = "" | ||
|
||
date_obs = "%4d-%02d-%02dT%02d:%02d:%06.3f%s" % (int(year), int(month), int(day), | ||
int(h), int(m), float(s), TZ) |
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.
If you are going to do sanitization without writing it to the headers, I'd much prefer that this code be put in a free function in the library path and called from there rather than having it in two places.
scripts/pre_ingest_sanitisation.py
Outdated
headers[filename]['IMAGETYP'] = 'OBJECT' # reflect patch in our dict | ||
this_file.flush() | ||
this_file.close() | ||
print 'Pathced header in %s'%filename |
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.
Pathced -> Patched
scripts/run_all.sh
Outdated
|
||
echo "lsst.obs.ctio0m9.Ctio0m9Mapper" > $REPO_DIR/_mapper | ||
|
||
# Ignore these entirely - I think these are all duplicates, or have the wrong size CCD |
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 check on these cases and delete this comment before committing to master.
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 script to rerun things doesn't really belong on the obs package, but I don't know a better place for it to live, and we don't want to create a new package for such things. I have made the comment less tentative, so that it accurately describes the state of the data on those paths, and it is no longer commented out code.
I have also renamed it from {{run_all.sh}} to {{run_all_pre_march2017.sh}} as this is more descriptive.
Please let me know if this doesn't fix your concerns here.
scripts/run_all.sh
Outdated
|
||
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
|
||
processCcd.py $REPO_DIR --rerun temp_1 --id visit='242612713' -c isr.doLinearize=False isr.doDefect=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.
This is a test to see if things worked? If so, please add a note to that effect.
scripts/run_all.sh
Outdated
constructFlat.py $REPO_DIR --rerun $whoami/calibs --id imgType='flat' filter='NONE+i' $batchArgs | ||
constructFlat.py $REPO_DIR --rerun $whoami/calibs --id imgType='flat' filter='NONE+z' $batchArgs | ||
constructFlat.py $REPO_DIR --rerun $whoami/calibs --id imgType='flat' filter='NONE+SEMROCK' $batchArgs | ||
# constructFlat.py $REPO_DIR --rerun $whoami/calibs --id imgType='flat' filter='RONCHI200+SEMROCK' $batchArgs |
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.
These are commented out for a reason? If they need to be run sometimes and not other times, can we add a command line argument that allows them to be turned on and off without modifying the 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.
Fixed to always be run.
2dc83ac
to
ab50fcb
Compare
This obs_package is pre-release, and was riddled with bugs/missing code. This large commit fixes all of that up. DM-10565 finishes the job. Fixes include but are not limited to: Update .gitignore Add translator functions for imgType and wavelength Register new columns Add filter aliases Fix whitespace errors and newlines Set default config override files Provide functions for sanitizing metadata Deal with multiple filter wheels update README Fix ingestCalibs Add bypass_ functions Add std_dark() function Add pre-processing scripts Add script to rerun all ingest and calib construction Add nominal CD matrix to all visits at runtime
ab50fcb
to
031ad23
Compare
No description provided.