[AstroPy] Pyfits writeto w/ clobber

Fabricio Ferrari fabricio at ferrari.pro.br
Tue Sep 14 13:35:02 EDT 2010


Also regarding Pyfits, the new version 1.3 has a problem when one
tries to pyfits.writeto() a file with the clobber=True argument. In
the previous version the clobber worked fine, but now it complains
when you try to overwrite a file.

Does anyone have a similar problem? Some solution?

thanks

F
..-. ..-.
Fabricio Ferrari       [www.ferrari.pro.br]
Universidade Federal do Pampa
Bagé RS
Brasil



2010/9/14  <astropy-request at scipy.org>:
> Send AstroPy mailing list submissions to
>        astropy at scipy.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://mail.scipy.org/mailman/listinfo/astropy
> or, via email, send a message with subject or body 'help' to
>        astropy-request at scipy.org
>
> You can reach the person managing the list at
>        astropy-owner at scipy.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of AstroPy digest..."
>
>
> Today's Topics:
>
>   1. Capturing pyfits warnings (Bridgman, William T.)
>   2. Re: Capturing pyfits warnings (Jim Vickroy)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 14 Sep 2010 09:41:40 -0400
> From: "Bridgman, William T." <william.t.bridgman at nasa.gov>
> Subject: [AstroPy] Capturing pyfits warnings
> To: AstroPy <astropy at scipy.net>
> Message-ID: <6B465667-81D2-4C0B-AF45-4B5A25942ADC at nasa.gov>
> Content-Type: text/plain; charset="US-ASCII"; format=flowed; delsp=yes
>
> I'm trying to get an inventory of all the FITS files I'm storing
> locally, to track down duplicates and determine data gaps in covering
> certain phenomena.
>
> I'm getting a warning from pyfits about file size mismatches.  Is
> there an elegant way to capture this message, or a warning code, that
> I can save with the file inventory record for generating a summary
> report?
>
> I see some items in the pyfits doc on capturing this with the warnings
> module but it seems more focussed on logging.  It is unclear how I
> would capture the warning information as a separate variable to save
> with the inventory dictionary.
>
> Thanks,
> Tom
> --
> Dr. William T."Tom" Bridgman               Scientific Visualization
> Studio
> Global Science & Technology, Inc.          NASA/Goddard Space Flight
> Center
> Email: William.T.Bridgman at nasa.gov         Code 610.3
> Phone: 301-286-1346                        Greenbelt, MD 20771
> FAX:   301-286-1634                        http://svs.gsfc.nasa.gov/
>
>
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 14 Sep 2010 08:24:58 -0600
> From: Jim Vickroy <Jim.Vickroy at noaa.gov>
> Subject: Re: [AstroPy] Capturing pyfits warnings
> To: "Bridgman, William T." <william.t.bridgman at nasa.gov>
> Cc: AstroPy <astropy at scipy.net>
> Message-ID: <4C8F85BA.8070609 at noaa.gov>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Bridgman, William T. wrote:
>> I'm trying to get an inventory of all the FITS files I'm storing
>> locally, to track down duplicates and determine data gaps in covering
>> certain phenomena.
>>
>> I'm getting a warning from pyfits about file size mismatches.  Is
>> there an elegant way to capture this message, or a warning code, that
>> I can save with the file inventory record for generating a summary
>> report?
>>
>> I see some items in the pyfits doc on capturing this with the warnings
>> module but it seems more focussed on logging.  It is unclear how I
>> would capture the warning information as a separate variable to save
>> with the inventory dictionary.
>>
>> Thanks,
>> Tom
>> --
>> Dr. William T."Tom" Bridgman               Scientific Visualization
>> Studio
>> Global Science & Technology, Inc.          NASA/Goddard Space Flight
>> Center
>> Email: William.T.Bridgman at nasa.gov         Code 610.3
>> Phone: 301-286-1346                        Greenbelt, MD 20771
>> FAX:   301-286-1634                        http://svs.gsfc.nasa.gov/
>>
>>
>>
>>
>> _______________________________________________
>> AstroPy mailing list
>> AstroPy at scipy.org
>> http://mail.scipy.org/mailman/listinfo/astropy
>>
> Does this work for you?
>
>  >>> import sys
>  >>> sys.version
> '2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)]'
>  >>> import pyfits
>  >>> pyfits.__version__
> '2.2.2'
>  >>> source = 'my.fit'
>  >>>
>  >>> try:
> ...     HDUs = pyfits.open(source)
> ... except IOError as error:
> ...    # do whatever you wish with the captured *error* ...
> ...     print error.message
> ...     print error.filename
> ...     print error.errno
> ...     print error.args
> ...     print error.strerror
> ... finally:
> ...     HDUs.close()
> ...
> Header missing END card.
> None
> None
> ('Header missing END card.',)
> None
>  >>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mail.scipy.org/pipermail/astropy/attachments/20100914/c96b0dc6/attachment-0001.html
>
> ------------------------------
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>
>
> End of AstroPy Digest, Vol 49, Issue 3
> **************************************
>



More information about the AstroPy mailing list