Base class for fplane file parsing and IFU.
This module provides a basic parser for the focal plane file and an object containing the informations about the IFU from the focal plane.
The focal plane is expected to be:
##IFUID x["] y["] xpos ypos specid
001 -450.0 150.0 1 3 001
002 -450.0 50.0 1 4 002
Commented lines are ignored.
The simplest use is to create a fplane instance passing the name of the focal plane file:
>>> fplane = FPlane("fplane.txt")
>>> print(fplane.difus)
{'001': <pyhetdex.het.fplane.IFU object at 0x7ff6a493c1d0>,
'002': <pyhetdex.het.fplane.IFU object at 0x7ff6a493d1d0>, ...}
If you need to customise the IFU object, without changing the constructor signature, you can do something like this:
>>> class MyIFU(IFU):
... def __init__(self, ifuid, x, y, xid, yid, specid):
... super(MyIFU, self).__init__(ifuid, x, y, xid, yid, specid)
... # do something else
... def new_method(self, a_variable):
... # implement
... pass
>>> fplane = FPlane("fplane.txt", ifu_class=MyIFU)
For more complex customisations, when you use a different way of storing the IFU informations, e.g. a list, a different __init__ signature, ..., you can override the FPlane.add_ifu() method:
>>> class MyFPlane(FPlane):
... def add_ifu(self, line):
... # reimplement at need
... pass
Contain the information for the IFU from the focal plane file.
Parameters: | ifuid : string
x, y : string or float
xid, yid : string or int
specid : string
|
---|
Attributes
ifuid, x, y, xid, yid, specid | (as before) |
ihmpid | (string) id of the IHMP seat address |
Focal plane.
Contains the dictionary of IFU instance (or derived or others), with the ifu id as key.
Parameters: | fplane_file : string
ifu_class : IFU instance (or anything else)
|
---|
Attributes
ids | list of ifu ids |
ifus | list of IFU instances |
difus | dictionary of ifus; key: ifuid; value: IFU instance |
Load the focal plane file and creates the IFU instances
Parameters: | fname : string
|
---|