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

DM-8798: Ingest HiTS calibration products and test on raw images #1

Merged
merged 9 commits into from Jan 31, 2017

Conversation

mrawls
Copy link
Collaborator

@mrawls mrawls commented Jan 25, 2017

Note: some of these commits have different usernames because git knew me as "mrawls" on lsst-dev and "Meredith Rawls" on my laptop. I have fixed it so both places use my full name.

hits_ingest.py Outdated
# images and calibration products
if doProcessCcd:
print('Running ProcessCcd...')
OBS_DECAM_DIR = os.getenv('OBS_DECAM_DIR')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from lsst.utils import getPackageDir
getPackageDir("obs_decam")

hits_ingest.py Outdated
if doProcessCcd:
print('Running ProcessCcd...')
OBS_DECAM_DIR = os.getenv('OBS_DECAM_DIR')
os.chdir(calibrepo)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I worry a little whenever a script needs to chdir; is this a consequence of DM-5466? If so, is it possible to ingest the calibs with absolute paths instead of relative, so this isn't required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, this is a consequence of DM-5466, which I really do plan to tackle soon. I don't like having the chdir in here either so I will add a comment/note to revisit this once obs_decam is a little smarter about calib paths.

print('lsst.obs.decam.DecamMapper', file=f)
f.close()

if doIngest == True:
if doIngest:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might just be a stylistic opinion on my part, but I think it would be a little nicer if the three different stages each lived in their own functions. Provides a bit more isolation (particularly when you reuse names like args and config) and visual definition.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree; I plan to implement this going forward, but not for this ticket.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I forgot to mention that I'm totally on board with some of these being "out of scope" for this ticket. No worries

hits_ingest.py Outdated
elif not doIngest and not doIngestCalibs and not doProcessCcd:
raise RuntimeError('Nothing to do, every task is set to False')

try:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should just be an if statement (if len(sys.argv) < 2:). Or argparse could handle this for you.


# first, need to make a text file that handles the mapper, per the obs_decam github README
f = open(repodir+'_mapper', 'w')
# edit values below as desired
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this block below here could basically be replaced with argparse and would be a bit more functional. Plus, you could make the --help text print the big message you have above, which would be very handy.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very familiar with argparse, but I will find some examples and keep this in mind going forward.

hits_ingest.py Outdated
print('WARNING: no data directory specified.')
print('(This is OK if you are just running ProcessCcd.)')
else:
if datadir[-1] == '/':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of relying on a /, which I would invariably forget had meaning, it might be nicer to use something like os.path.isdir().

@mrawls mrawls merged commit 2aec5fc into master Jan 31, 2017
@kfindeisen kfindeisen deleted the tickets/DM-8798 branch April 13, 2022 21:54
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 this pull request may close these issues.

None yet

2 participants