Skip to content

Commit 2dc8978

Browse files
committed
Move intermediate file save location to /pscratch/sd/l/laldorot. Update perlmutter example interactive_podman.sh file to match. Address some review comments.
1 parent e8f716f commit 2dc8978

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

examples/perlmutter/interactive_podman.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
podman-hpc run --gpu \
44
--mount type=bind,source=$PWD,target=/home \
55
--mount type=bind,source=$PWD/phrosty,target=/phrosty \
6+
--mount type=bind,source=$SCRATCH/phrosty_intermediate,target=/scratch \
67
--mount type=bind,source=$PWD/sn_info_dir,target=/sn_info_dir \
78
--mount type=bind,source=$PWD/dia_out_dir,target=/dia_out_dir \
89
--mount type=bind,source=$PWD/lc_out_dir,target=/lc_out_dir \

phrosty/pipeline.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ def __init__( self, imagepath, pointing, sca ):
5656
self.config = Config.get()
5757
self.temp_dir = pathlib.Path( self.config.value( 'photometry.phrosty.paths.temp_dir' ) )
5858
self.keep_intermediate = self.config.value( 'photometry.phrosty.keep_intermediate' )
59-
if not self.keep_intermediate:
59+
if self.keep_intermediate:
60+
self.save_dir = pathlib.Path( self.config.value( 'photometry.phrosty.paths.scratch_dir' ) )
61+
elif not self.keep_intermediate:
6062
self.save_dir = pathlib.Path( self.config.value( 'photometry.phrosty.paths.temp_dir' ) )
61-
elif self.keep_intermediate:
62-
self.save_dir = pathlib.Path( self.config.value( 'photometry.phrosty.paths.dia_out_dir' ) )
63+
6364

6465
if self.config.value( 'photometry.phrosty.image_type' ) == 'ou2024fits':
6566
self.image = OpenUniverse2024FITSImage( imagepath, None, sca )
@@ -71,6 +72,7 @@ def __init__( self, imagepath, pointing, sca ):
7172

7273
# Intermediate files
7374
if self.keep_intermediate:
75+
# Set to None. The path gets defined later on.
7476
self.skysub_path = None
7577
self.detmask_path = None
7678
self.input_sci_psf_path = None
@@ -90,7 +92,7 @@ def __init__( self, imagepath, pointing, sca ):
9092
self.zpt_stamp_path = {}
9193
self.diff_stamp_path = {}
9294

93-
# Used internally, held in-memory
95+
# Held in memory
9496
self.skyrms = None
9597
self.psfobj = None
9698
self.psf_data = None
@@ -130,15 +132,15 @@ def save_sky_subtract_info( self, info ):
130132
self.detmask_path = info[1]
131133
self.skyrms = info[2]
132134

133-
def get_psf( self, ra, dec, dump_file=False ):
135+
def get_psf( self, ra, dec, save_file=False ):
134136
"""Get the at the right spot on the image.
135137
136138
Parameters
137139
----------
138140
ra, dec : float
139141
The coordinates in decimal degrees where we want the PSFD.
140142
141-
dump_file : bool
143+
save_file : bool
142144
If True, write out the psf as a FITS file in dia_out_dir
143145
(for diagnostic purposes; these files are not read again
144146
interally by the pipeline).
@@ -151,7 +153,7 @@ def get_psf( self, ra, dec, dump_file=False ):
151153
# PSF. We need to fix that... somehow....
152154

153155
if self.keep_intermediate:
154-
dump_file = True
156+
save_file = True
155157

156158
if self.psfobj is None:
157159
psftype = self.config.value( 'photometry.phrosty.psf.type' )
@@ -160,7 +162,7 @@ def get_psf( self, ra, dec, dump_file=False ):
160162
wcs = self.image.get_wcs()
161163
x, y = wcs.world_to_pixel( ra, dec )
162164
stamp = self.psfobj.get_stamp( x, y )
163-
if dump_file:
165+
if save_file:
164166
outfile = pathlib.Path( self.config.value( "photometry.phrosty.paths.dia_out_dir" ) )
165167
outfile = outfile / f"psf_{self.image.name}.fits"
166168
fits.writeto( outfile, stamp, overwrite=True )
@@ -206,6 +208,7 @@ def __init__( self, object_id, ra, dec, band, science_images, template_images, n
206208
self.config = Config.get()
207209
self.image_base_dir = pathlib.Path( self.config.value( 'photometry.phrosty.paths.image_base_dir' ) )
208210
self.dia_out_dir = pathlib.Path( self.config.value( 'photometry.phrosty.paths.dia_out_dir' ) )
211+
self.scratch_dir = pathlib.Path( self.config.value( 'photometry.phrosty.paths.scratch_dir' ) )
209212
self.ltcv_dir = pathlib.Path( self.config.value( 'photometry.phrosty.paths.ltcv_dir' ) )
210213

211214
self.object_id = object_id
@@ -651,6 +654,8 @@ def log_fits_write_error( savepath, x ):
651654
# image.image.name ends in fits.gz.
652655

653656
# TODO: Include score and variance images. Include multiprocessing.
657+
# In the future, we may want to write these things right after they happen
658+
# instead of saving it all for the end of the SFFT stuff.
654659
write_filepaths = {'aligned': [['img',
655660
templ_image.image.name,
656661
cp.asnumpy(sfftifier.PixA_resamp_object_GPU),
@@ -682,7 +687,7 @@ def log_fits_write_error( savepath, x ):
682687
# Write the aligned images
683688
for key in write_filepaths.keys():
684689
for (imgtype, name, data, header) in write_filepaths[key]:
685-
savepath = self.dia_out_dir / f'{key}_{imgtype}_{name}'
690+
savepath = self.scratch_dir / f'{key}_{imgtype}_{name}'
686691
self.write_fits_file( data, header, savepath=savepath)
687692

688693
SNLogger.info( f"DONE processing {sci_image.image.name} minus {templ_image.image.name}" )

0 commit comments

Comments
 (0)