spacetelescope / drizzlepac

AstroDrizzle for HST images.
https://drizzlepac.readthedocs.io
BSD 3-Clause "New" or "Revised" License
52 stars 38 forks source link

Path to directory changed to lower case #79

Closed dborncamp closed 7 years ago

dborncamp commented 7 years ago

Using drizzlepac version 2.1.17, has anyone else noticed some weird things happening when writing the blot image? It seems that the path to the file gets lower-cased. In the output below darkTesting got changed to darktesting. Did a .lower() get called in somewhere by mistake?

reference sky value for image  /grp/hst/acs7/dborncamp/darkTesting/ff/jcqtb9w7q_flc.fits  is  25.5566139221

reference sky value for image  /grp/hst/acs7/dborncamp/darkTesting/ff/jcqtb9weq_flc.fits  is  25.5818347931

Saving output median image to:  abells1063F435_med.fits

==== Processing Step  Create Median  finished at  14:57:25.748 (15/08/2017)

==== Processing Step  Blot  started at  14:57:25.757 (15/08/2017)

    Blot: creating blotted image:  /grp/hst/acs7/dborncamp/darkTesting/ff/jcqtb1rkq_flc.fits[sci,1]

Using default C-based coordinate transformation...

-Generating simple FITS output: /grp/hst/acs7/dborncamp/darktesting/ff/jcqtb1rkq_sci1_blt.fits

Writing out image to disk: /grp/hst/acs7/dborncamp/darktesting/ff/jcqtb1rkq_sci1_blt.fits
mcara commented 7 years ago

@dborncamp I think you are right. However, I wonder why is the code not crashing when attempting to write to a non-existing directory (darktesting != darkTesting)???

I think the observed behavior was intentionally programmed in https://github.com/spacetelescope/drizzlepac/blob/master/lib/drizzlepac/imageObject.py#L339 I do not know the reason for this... CC: @stsci-hack

larrybradley commented 7 years ago

@dborncamp I think you are right. However, I wonder why is the code not crashing when >attempting to write to a non-existing directory (darktesting != darkTesting)???

@mcara The default OSX filesystem is case insensitive (darktesting == darkTesting).

mcara commented 7 years ago

@larrybradley Oh, man... You are right: I was thinking of Linux and completely forgot of OSX (probably because it is case-insensitive => not many opportunities to be reminded of case).

dborncamp commented 7 years ago

@mcara - It did eventually error out and print 2 stack traces for some reason:


Writing out image to disk: /grp/hst/acs7/dborncamp/darktesting/ff/jcqtb1rkq_sci1_blt.fits

##############################################################################
#                                                                            #
# ERROR:                                                                     #
# AstroDrizzle Version 2.1.17 encountered a problem!  Processing terminated  #
# at 14:57:29.916 (15/08/2017).                                              #
#                                                                            #
##############################################################################

   --------------------          --------------------
                   Step          Elapsed time
   --------------------          --------------------

         Initialization          150.7773 sec.

            Static Mask          76.8346 sec.

           Subtract Sky          146.0509 sec.

       Separate Drizzle          84.5817 sec.

          Create Median          206.7681 sec.

                   Blot          0.0000 sec.

   ====================          ====================

                  Total          665.0126 sec.

Trailer file written to:  astrodrizzle.log

---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
/Users/dborncamp/miniconda2/envs/astro/lib/python2.7/site-packages/drizzlepac/util.pyc in wrapper(*args, **kwargs)
    217             # finally clause is reached.
    218             try:
--> 219                 func(*args, **kwargs)
    220             except Exception as errorobj:
    221                 raise

/Users/dborncamp/miniconda2/envs/astro/lib/python2.7/site-packages/drizzlepac/astrodrizzle.pyc in run(configobj, wcsmap)
    218         #blot the images back to the original reference frame
    219         ablot.runBlot(imgObjList, outwcs, configobj, wcsmap=wcsmap,
--> 220                       procSteps=procSteps)
    221
    222         #look for cosmic rays

/Users/dborncamp/miniconda2/envs/astro/lib/python2.7/site-packages/drizzlepac/ablot.pyc in runBlot(imageObjectList, output_wcs, configObj, wcsmap, procSteps)
    185
    186         run_blot(imageObjectList, output_wcs.single_wcs, paramDict,
--> 187                  wcsmap=wcsmap)
    188     else:
    189         log.info('Blot step not performed.')

/Users/dborncamp/miniconda2/envs/astro/lib/python2.7/site-packages/drizzlepac/ablot.pyc in run_blot(imageObjectList, output_wcs, paramDict, wcsmap)
    317             outimgs = _outimg.writeFITS(plist['data'],_outsci,None,
    318                                 versions=_versions,blend=False,
--> 319                                 virtual=img.inmemory)
    320
    321             img.saveVirtualOutputs(outimgs)

/Users/dborncamp/miniconda2/envs/astro/lib/python2.7/site-packages/drizzlepac/outputimage.pyc in writeFITS(self, template, sciarr, whtarr, ctxarr, versions, overwrite, blend, virtual)
    463                 print('Writing out image to disk:',self.outdata)
    464                 # write out file to disk
--> 465                 fo.writeto(self.outdata)
    466                 del fo,hdu
    467                 fo = None

/Users/dborncamp/miniconda2/envs/astro/lib/python2.7/site-packages/astropy/utils/decorators.pyc in wrapper(*args, **kwargs)
    505                         # one with the name of the new argument to the function
    506                         kwargs[new_name[i]] = value
--> 507             return function(*args, **kwargs)
    508
    509         return wrapper

/Users/dborncamp/miniconda2/envs/astro/lib/python2.7/site-packages/astropy/io/fits/hdu/hdulist.pyc in writeto(self, fileobj, output_verify, overwrite, checksum)
    867         # file object that's open to write only, or in append/update modes
    868         # but only if the file doesn't exist.
--> 869         fileobj = _File(fileobj, mode='ostream', overwrite=overwrite)
    870         hdulist = self.fromfile(fileobj)
    871

/Users/dborncamp/miniconda2/envs/astro/lib/python2.7/site-packages/astropy/utils/decorators.pyc in wrapper(*args, **kwargs)
    505                         # one with the name of the new argument to the function
    506                         kwargs[new_name[i]] = value
--> 507             return function(*args, **kwargs)
    508
    509         return wrapper

/Users/dborncamp/miniconda2/envs/astro/lib/python2.7/site-packages/astropy/io/fits/file.pyc in __init__(self, fileobj, mode, memmap, overwrite, cache)
    142             self._open_fileobj(fileobj, mode, overwrite)
    143         elif isinstance(fileobj, string_types):
--> 144             self._open_filename(fileobj, mode, overwrite)
    145         else:
    146             self._open_filelike(fileobj, mode, overwrite)

/Users/dborncamp/miniconda2/envs/astro/lib/python2.7/site-packages/astropy/io/fits/file.pyc in _open_filename(self, filename, mode, overwrite)
    497             self._file = bz2.BZ2File(self.name, bzip2_mode)
    498         else:
--> 499             self._file = fileobj_open(self.name, IO_FITS_MODES[mode])
    500
    501         # Make certain we're back at the beginning of the file

/Users/dborncamp/miniconda2/envs/astro/lib/python2.7/site-packages/astropy/io/fits/util.pyc in fileobj_open(filename, mode)
    391         """
    392
--> 393         return open(filename, mode)
    394 else:
    395     def fileobj_open(filename, mode):

IOError: [Errno 2] No such file or directory: '/grp/hst/acs7/dborncamp/darktesting/ff/jcqtb1rkq_sci1_blt.fits'
---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-17-01e64404c947> in <module>()
----> 1 makeff.combine('ff435.list')

/grp/hst/acs7/dborncamp/darkTesting/software/makeff.py in combine(imagelist, wcsname, output)
     33     astrodrizzle.AstroDrizzle("@" + imagelist, mdriztab=True, output=output,
     34                               driz_separate=True, median=True, blot=True,
---> 35                               driz_cr=True, driz_combine=True, wcskey=wcsname)

/Users/dborncamp/miniconda2/envs/astro/lib/python2.7/site-packages/drizzlepac/astrodrizzle.pyc in AstroDrizzle(input, mdriztab, editpars, configobj, wcsmap, **input_dict)
    121     # already called 'run()'.
    122     if not editpars:
--> 123         run(configObj, wcsmap=wcsmap)
    124
    125 #

/Users/dborncamp/miniconda2/envs/astro/lib/python2.7/site-packages/drizzlepac/util.pyc in wrapper(*args, **kwargs)
    227                     # (hope that end_logging didn't change the last exception raised)
    228                     if errorobj:
--> 229                         raise errorobj
    230
    231         return wrapper

IOError: [Errno 2] No such file or directory: '/grp/hst/acs7/dborncamp/darktesting/ff/jcqtb1rkq_sci1_blt.fits'
mcara commented 7 years ago

Hm... that's probably because /grp/... is sitting on a Linux machine.

mcara commented 7 years ago

@dborncamp A workaround would be to set in_memory=True for now if this works for you (=unless you do need to see temporary files).

jdavies-st commented 7 years ago

It looks like that call .lower() is a bug. I can see using .lower() on the EXTNAME 2 lines up, but not on the root path name.

dborncamp commented 7 years ago

@mcara My workaround was to rename the directory path...

mcara commented 7 years ago

Fixed in https://github.com/spacetelescope/drizzlepac/pull/80 I will make a release once I get more fixes into drizzlepac.