[Tutor] Instancing class issue

Dino Bektešević ljetibo at gmail.com
Mon Aug 12 20:32:37 CEST 2013


Hello,

I have an unusual problem when I try to instance a class Astrom from a set
of tools for astronomy SDSSPY. Here's the link to the project page:
http://code.google.com/p/sdsspy/
and this is the class I'm having problems instancing:
http://code.google.com/p/sdsspy/source/browse/sdsspy/astrom.py
I'm running LucidLynx ("You are using Ubuntu 10.04 LTS released in April
2010 and supported until April 2013.") on a Oracle VirtualBox v4.2.12 and
I'm using Python 2.6.5. (reason being that I'm also importing various other
modules like esutil, scipy, numpy of which some don't work properly on
never version, or so I have been informed). "Home" OS is win7 64bit.
I'm not new to programming but don't consider me an expert, or even amateur
in python, most about python I learned from diveintopython and other random
sources I used as I got further into it solving problems.

Ok now onto the problem itself:
There's a method pix2eq in the class Astrom I wish to use. However because
it's inside a class obviously I need to instance it because you can only
use methods on class instances. When I read the Astrom class definition
there clearly states:

    def __init__(self, **keys):
        from . import util

        self.keys=keys
        self.load()

where I don't understand what **keys mean, I've only seen that as **kwargs
meaning other key words and arguments in examples. When I try to instance
Astrom class by:
new=Astrom()
I receive a following error:

Traceback (most recent call last):
  File "<pyshell#7>", line 1, in <module>
    novi=Astrom()
  File "/usr/local/lib/python2.6/dist-packages/sdsspy/astrom.py", line 44,
in __init__
    self.load()
  File "/usr/local/lib/python2.6/dist-packages/sdsspy/astrom.py", line 266,
in load
    raise ValueError("send run= and camcol=")
ValueError: send run= and camcol=

which seems pretty straight forward except that I don't see it requiring me
to do so anywhere and that when I try to follow instructions:

new = Astrom(run=2888, camcol=1)

(both run 002888 and camcol 1 exist I have the images I need downloaded on
my drive already) I recieve error about my enviroment:

Traceback (most recent call last):
  File "<pyshell#11>", line 1, in <module>
    novi = Astrom (run=2888, camcol=1)
  File "/usr/local/lib/python2.6/dist-packages/sdsspy/astrom.py", line 44,
in __init__
    self.load()
  File "/usr/local/lib/python2.6/dist-packages/sdsspy/astrom.py", line 270,
in load
    fname=files.filename('photoField', **keys)
  File "/usr/local/lib/python2.6/dist-packages/sdsspy/files.py", line 274,
in filename
    return fs.filename(ftype, run, camcol, field, **keys)
  File "/usr/local/lib/python2.6/dist-packages/sdsspy/files.py", line 479,
in filename
    f = expand_sdssvars(f, run=run, camcol=camcol, field=field, **keys)
  File "/usr/local/lib/python2.6/dist-packages/sdsspy/files.py", line 870,
in expand_sdssvars
    raise ValueError(err)
ValueError: There were unexpanded variables: '$PHOTO_REDUX/runList.par',
there may be no such run but you might try sending the rerun

except search doesn't pop-out any runList.par files anywhere.
Is it something I'm doing wrong or is it something I should contact the
author Mr. Sheldon personally? Any comment about the class is appreciated,
including the Astrom(object) type inheritance.

Help is greatly appreciated,
Dino Bektešević
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130812/55c40e5b/attachment-0001.html>


More information about the Tutor mailing list