[yt-users] Problem dealing with FITS data in yt

John Zuhone jzuhone at gmail.com
Thu Sep 7 12:35:06 PDT 2017


Hi Tazkera, 

Thanks for uploading your file—it will make it far simpler to debug. I’ll have a look at this and get back to you. 

Best,

John

> On Sep 7, 2017, at 3:24 PM, tazkera haque <h.tazkera at gmail.com> wrote:
> 
> HI People, 
> 
> I am sorry to ask you a very novice question, but I am new to deal with FITS data and I wanted to load it into yt to do some processing. I uploaded my file here.
> 
> First of all, I am trying to load my first FITS data in yt and it returns me an error which I don't understand:
> 
> import yt
> ds = yt.load("signal_wfilt_sn.fits")
> ds.print_stats()
> 
> the error:
> 
> yt : [WARNING  ] 2017-09-07 15:12:42,963 Cannot find time
> yt : [INFO     ] 2017-09-07 15:12:42,965 Detected these axes: RA---TAN DEC--TAN 
> yt : [WARNING  ] 2017-09-07 15:12:42,979 No length conversion provided. Assuming 1 = 1 cm.
> yt : [INFO     ] 2017-09-07 15:12:42,996 Parameters: current_time              = 0.0
> yt : [INFO     ] 2017-09-07 15:12:42,997 Parameters: domain_dimensions         = [1629 1629    1]
> yt : [INFO     ] 2017-09-07 15:12:43,001 Parameters: domain_left_edge          = [ 0.5  0.5  0.5]
> yt : [INFO     ] 2017-09-07 15:12:43,004 Parameters: domain_right_edge         = [  1.62950000e+03   1.62950000e+03   1.50000000e+00]
> yt : [INFO     ] 2017-09-07 15:12:43,006 Parameters: cosmological_simulation   = 0.0
> ---------------------------------------------------------------------------
> IndexError                                Traceback (most recent call last)
> <ipython-input-38-71d5999c6b09> in <module>()
>       1 import yt
>       2 ds2 = yt.load("/home/trina/Documents/ASTRO_732/A-01/signal_wfilt_sn.fits")
> ----> 3 ds2.print_stats()
> 
> /home/trina/anaconda2/lib/python2.7/site-packages/yt/utilities/parallel_tools/parallel_analysis_interface.pyc in root_only(*args, **kwargs)
>     318     def root_only(*args, **kwargs):
>     319         if not parallel_capable:
> --> 320             return func(*args, **kwargs)
>     321         comm = _get_comm(args)
>     322         rv = None
> 
> /home/trina/anaconda2/lib/python2.7/site-packages/yt/data_objects/static_output.pyc in print_stats(self)
>     455     @parallel_root_only
>     456     def print_stats(self):
> --> 457         self.index.print_stats()
>     458 
>     459     @property
> 
> /home/trina/anaconda2/lib/python2.7/site-packages/yt/data_objects/static_output.pyc in index(self)
>     417                 raise RuntimeError("You should not instantiate Dataset.")
>     418             self._instantiated_index = self._index_class(
> --> 419                 self, dataset_type=self.dataset_type)
>     420             # Now we do things that we need an instantiated index for
>     421             # ...first off, we create our field_info now.
> 
> /home/trina/anaconda2/lib/python2.7/site-packages/yt/frontends/fits/data_structures.pyc in __init__(self, ds, dataset_type)
>      90         self._handle = ds._handle
>      91         self.float_type = np.float64
> ---> 92         GridIndex.__init__(self,ds,dataset_type)
>      93 
>      94     def _initialize_data_storage(self):
> 
> /home/trina/anaconda2/lib/python2.7/site-packages/yt/geometry/geometry_handler.pyc in __init__(self, ds, dataset_type)
>      56         # potentially quite expensive, and should be done with the indexing.
>      57         mylog.debug("Detecting fields.")
> ---> 58         self._detect_output_fields()
>      59 
>      60     def _initialize_state_variables(self):
> 
> /home/trina/anaconda2/lib/python2.7/site-packages/yt/frontends/fits/data_structures.pyc in _detect_output_fields(self)
>     171                     continue
>     172                 if self._ensure_same_dims(hdu):
> --> 173                     units = self._determine_image_units(hdu.header, known_units)
>     174                     try:
>     175                         # Grab field name from btype
> 
> /home/trina/anaconda2/lib/python2.7/site-packages/yt/frontends/fits/data_structures.pyc in _determine_image_units(self, header, known_units)
>     116                     n += 1
>     117             if n != len(units): field_units = "dimensionless"
> --> 118             if field_units[0] == "/":
>     119                 field_units = "1%s" % field_units
>     120             return field_units
> 
> IndexError: string index out of range
> 
> Can you Please suggest me how to load and work on this data?
> 
> My goal is to create an image from the signal to noise data in the data file 'signal_wfilt_sn.fits' using only data
> within 20 arcminutes of the center of the image. the pixel size is 3x3 arc second
> 
> I had an initial code in mind which will create a sphere with a radius of 20 arcminute:
> 
> 
> import yt
> ds = yt.load("signal_wfilt_sn.fits")
> ds.print_stats()
> sp = ds.sphere(ds.domain_center, (400, 'code_length'))
> 
> However, I first need to be able to load and explore the data. Your help and suggestion is greatly appreciated.
> 
> Thanks a lot
> 
> Tazkera
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ​​
> <signal_wfilt_sn.fits>_______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170907/558de028/attachment.html>


More information about the yt-users mailing list