<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 02/26/2013 09:51 AM, Andy Ptak
      wrote:<br>
    </div>
    <blockquote cite="mid:C3359BD7-918F-4045-8C63-026848D985F8@nasa.gov"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <div style="word-wrap:break-word">Hello,
        <div>I am trying out reading VOTables using and am having
          trouble.  Specifically reading tables returned by the Hubble
          Legacy Archive.  The query was:</div>
        <div><span style="font-family:Arial"><a moz-do-not-send="true"
href="http://hla.stsci.edu/cgi-bin/hlaSIAP.cgi?inst=ACS&pos=11.888333,-25.288056&size=0.001389">http://hla.stsci.edu/cgi-bin/hlaSIAP.cgi?inst=ACS&pos=11.888333,-25.288056&size=0.001389</a></span></div>
        <div><span style="font-family:Arial">which I attached.</span></div>
        <div><span style="font-family:Arial"><br>
          </span></div>
        <div><font face="Arial">I am using astropy installed by pip on
            the enthought distribution on a mac, so its version 0.2 and
            numpy got upgraded to 1.7.0 (if that matters).</font></div>
        <div><font face="Arial">First, is there a way to have a votable
            imported directly from query without saving it to a 
            physical file first?  Maybe its best practice to save VO
            queries to a file to trace errors, in case the votable is
            very large, etc. but when you know you are getting something
            back that is small and (as in this case) you mainly want a
            list of fields for further work, saving the full votable
            seams like an unnecessary extra step.</font></div>
      </div>
    </blockquote>
    <br>
    You can pass an http url to astropy.io.votable.parse, e.g.:<br>
    <br>
    In [2]: from astropy.io import votable<br>
    <br>
    In [3]:
votable.parse(<a class="moz-txt-link-rfc2396E" href="http://hla.stsci.edu/cgi-bin/hlaSIAP.cgi?inst=ACS&pos=11.888333,-25.288056&size=0.001389">"http://hla.stsci.edu/cgi-bin/hlaSIAP.cgi?inst=ACS&pos=11.888333,-25.288056&size=0.001389"</a>)<br>
    <br>
    <blockquote cite="mid:C3359BD7-918F-4045-8C63-026848D985F8@nasa.gov"
      type="cite">
      <div style="word-wrap:break-word">
        <div><font face="Arial"><br>
          </font></div>
        <div><font face="Arial">The errors I am getting are below.  I
            got similar errors when using a different votable call I
            found on the HLA website (basically the same except using
            acsSIAP.cgi?strict=1</font></div>
        <div><font face="Arial">Is this a problem with the Votable being
            returned by stsci, a bug or am I doing something wrong?</font></div>
      </div>
    </blockquote>
    <br>
    Interestingly, I'm not able to reproduce the exception here.  (This
    is on Linux, with Python 2.7, astropy 0.2 and numpy 1.7.0).<br>
    <br>
    Would you mind tinkering around in the debugger for me?  Turn on the
    IPython debugger with "%pdb", reproduce the crash, and then go up
    two levels and print out "array_chunk"?  I'm curious if there's some
    messed up values getting in there.<br>
    <br>
    Thanks,<br>
    Mike<br>
    <br>
    <blockquote cite="mid:C3359BD7-918F-4045-8C63-026848D985F8@nasa.gov"
      type="cite">
      <div style="word-wrap:break-word">
        <div><font face="Arial"><br>
          </font></div>
        <div><font face="Arial">Thanks,</font></div>
        <div><font face="Arial">Andy Ptak</font></div>
        <div><font face="Arial"><br>
          </font></div>
        <div><font face="Arial"><br>
          </font></div>
        <div><font face="Arial"><br>
          </font></div>
        <div><font face="Arial">
            <div>In [4]: from astropy.io.votable import parse</div>
            <div>In [6]: votable = parse("test1.xml")</div>
            <div>WARNING: W42: test1.xml:3:0: W42: No XML namespace
              specified [astropy.io.votable.exceptions]</div>
            <div>WARNING: W03: test1.xml:7:4: W03: Implictly generating
              an ID from a name 'INPUT:POS' -> 'INPUT_POS'
              [astropy.io.votable.exceptions]</div>
            <div>WARNING: W03: test1.xml:8:4: W03: Implictly generating
              an ID from a name 'INPUT:SIZE' -> 'INPUT_SIZE'
              [astropy.io.votable.exceptions]</div>
            <div>WARNING: W03: test1.xml:9:4: W03: Implictly generating
              an ID from a name 'INPUT:FORMAT' -> 'INPUT_FORMAT'
              [astropy.io.votable.exceptions]</div>
            <div>WARNING: W03: test1.xml:10:4: W03: Implictly generating
              an ID from a name 'INPUT:imagetype' ->
              'INPUT_imagetype' [astropy.io.votable.exceptions]</div>
            <div>WARNING: W03: test1.xml:11:4: W03: Implictly generating
              an ID from a name 'INPUT:inst' -> 'INPUT_inst'
              [astropy.io.votable.exceptions]</div>
            <div>WARNING: W03: test1.xml:12:4: W03: Implictly generating
              an ID from a name 'INPUT:hrcmatch' -> 'INPUT_hrcmatch'
              [astropy.io.votable.exceptions]</div>
            <div>WARNING: W03: test1.xml:13:4: W03: Implictly generating
              an ID from a name 'INPUT:zoom' -> 'INPUT_zoom'
              [astropy.io.votable.exceptions]</div>
            <div>WARNING: W03: test1.xml:14:4: W03: Implictly generating
              an ID from a name 'INPUT:autoscale' ->
              'INPUT_autoscale' [astropy.io.votable.exceptions]</div>
            <div>WARNING: W03: test1.xml:15:4: W03: Implictly generating
              an ID from a name 'INPUT:asinh' -> 'INPUT_asinh'
              [astropy.io.votable.exceptions]</div>
            <div>WARNING: W06: test1.xml:16:4: W06: Invalid UCD
              'VOX:STC_CoordRefFrame': UCD has invalid character ':' in
              'VOX:STC_CoordRefFrame' [astropy.io.votable.exceptions]</div>
            <div>WARNING: W06: test1.xml:17:4: W06: Invalid UCD
              'VOX:WCS_CoordProjection': UCD has invalid character ':'
              in 'VOX:WCS_CoordProjection'
              [astropy.io.votable.exceptions]</div>
            <div>WARNING: W06: test1.xml:19:6: W06: Invalid UCD
              'VOX:Image_AccessReference': UCD has invalid character ':'
              in 'VOX:Image_AccessReference'
              [astropy.io.votable.exceptions]</div>
            <div>WARNING: W06: test1.xml:82:6: W06: Invalid UCD
              'VOX:Image_Format': UCD has invalid character ':' in
              'VOX:Image_Format' [astropy.io.votable.exceptions]</div>
            <div>WARNING: W06: test1.xml:91:6: W06: Invalid UCD
              'VOX:Image_Title': UCD has invalid character ':' in
              'VOX:Image_Title' [astropy.io.votable.exceptions]</div>
            <div>WARNING: W06: test1.xml:94:6: W06: Invalid UCD
              'VOX:Image_Naxis': UCD has invalid character ':' in
              'VOX:Image_Naxis' [astropy.io.votable.exceptions]</div>
            <div>WARNING: W06: test1.xml:97:6: W06: Invalid UCD
              'VOX:Image_Scale': UCD has invalid character ':' in
              'VOX:Image_Scale' [astropy.io.votable.exceptions]</div>
            <div>WARNING: W06: test1.xml:100:6: W06: Invalid UCD
              'VOX:Image_Naxes': UCD has invalid character ':' in
              'VOX:Image_Naxes' [astropy.io.votable.exceptions]</div>
            <div>WARNING: W06: test1.xml:103:6: W06: Invalid UCD
              'VOX:WCS_CoordRefPixel': UCD has invalid character ':' in
              'VOX:WCS_CoordRefPixel' [astropy.io.votable.exceptions]</div>
            <div>WARNING: W06: test1.xml:106:6: W06: Invalid UCD
              'VOX:WCS_CoordRefValue': UCD has invalid character ':' in
              'VOX:WCS_CoordRefValue' (suppressing further warnings of
              this type...) [astropy.io.votable.exceptions]</div>
            <div>ERROR: OverflowError: Python int too large to convert
              to C long [numpy.ma.core]</div>
            <div>---------------------------------------------------------------------------</div>
            <div>OverflowError                             Traceback
              (most recent call last)</div>
            <div>/Volumes/Apps_and_Docs/aptak/Dropbox/HLA/<ipython-input-6-61a1dc44cf49>
              in <module>()</div>
            <div>----> 1 votable = parse("test1.xml")</div>
            <div><br>
            </div>
            <div>/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/astropy/io/votable/table.pyc
              in parse(source, columns, invalid, pedantic, chunk_size,
              table_number, table_id, filename,
              _debug_python_based_parser)</div>
            <div>    114        
              _debug_python_based_parser=_debug_python_based_parser) as
              iterator:</div>
            <div>    115         return tree.VOTableFile(</div>
            <div>--> 116             config=config, pos=(1,
              1)).parse(iterator, config)</div>
            <div>    117 </div>
            <div>    118 </div>
            <div><br>
            </div>
            <div>/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/astropy/io/votable/tree.pyc
              in parse(self, iterator, config)</div>
            <div>   3084             if start:</div>
            <div>   3085                 tag_mapping.get(tag,
              self._add_unknown_tag)(</div>
            <div>-> 3086                     iterator, tag, data,
              config, pos)</div>
            <div>   3087             elif tag == 'DESCRIPTION':</div>
            <div>   3088                 if self.description is not
              None:</div>
            <div><br>
            </div>
            <div>/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/astropy/io/votable/tree.pyc
              in _add_resource(self, iterator, tag, data, config, pos)</div>
            <div>   3015         resource = Resource(config=config,
              pos=pos, **data)</div>
            <div>   3016         self.resources.append(resource)</div>
            <div>-> 3017         resource.parse(self, iterator,
              config)</div>
            <div>   3018 </div>
            <div>   3019     def _add_coosys(self, iterator, tag, data,
              config, pos):</div>
            <div><br>
            </div>
            <div>/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/astropy/io/votable/tree.pyc
              in parse(self, votable, iterator, config)</div>
            <div>   2871             if start:</div>
            <div>   2872                 tag_mapping.get(tag,
              self._add_unknown_tag)(</div>
            <div>-> 2873                     iterator, tag, data,
              config, pos)</div>
            <div>   2874             elif tag == 'DESCRIPTION':</div>
            <div>   2875                 if self.description is not
              None:</div>
            <div><br>
            </div>
            <div>/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/astropy/io/votable/tree.pyc
              in _add_table(self, iterator, tag, data, config, pos)</div>
            <div>   2828         table = Table(self._votable,
              config=config, pos=pos, **data)</div>
            <div>   2829         self.tables.append(table)</div>
            <div>-> 2830         table.parse(iterator, config)</div>
            <div>   2831 </div>
            <div>   2832     def _add_info(self, iterator, tag, data,
              config, pos):</div>
            <div><br>
            </div>
            <div>/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/astropy/io/votable/tree.pyc
              in parse(self, iterator, config)</div>
            <div>   2212                             'TABLEDATA',
              data.iterkeys(), config, pos)</div>
            <div>   2213                         self.array =
              self._parse_tabledata(</div>
            <div>-> 2214                             iterator,
              colnumbers, fields, config)</div>
            <div>   2215                         break</div>
            <div>   2216                     elif tag == 'BINARY':</div>
            <div><br>
            </div>
            <div>/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/astropy/io/votable/tree.pyc
              in _parse_tabledata(self, iterator, colnumbers, fields,
              config)</div>
            <div>   2357 </div>
            <div>   2358         array = _resize(array, alloc_rows)</div>
            <div>-> 2359         array[numrows:] = array_chunk</div>
            <div>   2360         if alloc_rows != 0:</div>
            <div>   2361             array.mask[numrows:] = mask_chunk</div>
            <div><br>
            </div>
            <div>/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/numpy/ma/core.pyc
              in __setslice__(self, i, j, value)</div>
            <div>   3067 </div>
            <div>   3068         """</div>
            <div>-> 3069         self.__setitem__(slice(i, j), value)</div>
            <div>   3070 </div>
            <div>   3071 </div>
            <div><br>
            </div>
            <div>/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/numpy/ma/core.pyc
              in __setitem__(self, indx, value)</div>
            <div>   3031                 _mask =
              ndarray.__getattribute__(self, '_mask')</div>
            <div>   3032             # Set the data, then the mask</div>
            <div><br>
            </div>
            <div>-> 3033             ndarray.__setitem__(_data, indx,
              dval)</div>
            <div>   3034             ndarray.__setitem__(_mask, indx,
              mval)</div>
            <div>   3035         elif hasattr(indx, 'dtype') and
              (indx.dtype == MaskType):</div>
            <div><br>
            </div>
            <div>OverflowError: Python int too large to convert to C
              long</div>
          </font></div>
      </div>
      <div style="word-wrap:break-word">
        <div><font face="Arial">
          </font></div>
      </div>
    </blockquote>
    <br>
  </body>
</html>