Skip to content

Commit

Permalink
Switch from Table to QTable
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonKrughoff committed Nov 20, 2019
1 parent 87abed1 commit 1655b74
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions python/lsst/meas/algorithms/simple_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
__all__ = ["Curve", "AmpCurve", "DetectorCurve", "ImageCurve"]

from scipy.interpolate import interp1d
from astropy.table import Table
from astropy.table import QTable
import astropy.units as u
from abc import ABC, abstractmethod
import datetime
Expand Down Expand Up @@ -60,7 +60,7 @@ def fromTable(cls, table):
Parameters
----------
table : `astropy.table.Table`
table : `astropy.table.QTable`
Table containing metadata and columns necessary
for constructing a `Curve` object.
Expand All @@ -74,11 +74,11 @@ def fromTable(cls, table):

@abstractmethod
def toTable(self):
"""Convert this `Curve` object to an `astropy.table.Table`.
"""Convert this `Curve` object to an `astropy.table.QTable`.
Returns
-------
table : `astropy.table.Table`
table : `astropy.table.QTable`
A table object containing the data from this `Curve`.
"""
pass
Expand Down Expand Up @@ -198,7 +198,7 @@ def readText(cls, filename):
A `Curve` subclass of the appropriate type according
to the table metadata
"""
table = Table.read(filename, format='ascii.ecsv')
table = QTable.read(filename, format='ascii.ecsv')
return cls.subclasses[table.meta['MODE']].fromTable(table)

@classmethod
Expand All @@ -217,7 +217,7 @@ def readFits(cls, filename):
A `Curve` subclass of the appropriate type according
to the table metadata
"""
table = Table.read(filename, format='fits')
table = QTable.read(filename, format='fits')
return cls.subclasses[table.meta['MODE']].fromTable(table)

@staticmethod
Expand Down Expand Up @@ -303,11 +303,11 @@ def __eq__(self, other):
def fromTable(cls, table):
# Docstring inherited from base classs
cls._check_cols(['wavelength', 'efficiency'], table)
return cls(table['wavelength'].quantity, table['efficiency'].quantity, table.meta)
return cls(table['wavelength'], table['efficiency'], table.meta)

def toTable(self):
# Docstring inherited from base classs
return Table({'wavelength': self.wavelength, 'efficiency': self.efficiency}, meta=self.metadata)
return QTable({'wavelength': self.wavelength, 'efficiency': self.efficiency}, meta=self.metadata)

def evaluate(self, detector, position, wavelength, kind='linear'):
# Docstring inherited from base classs
Expand Down Expand Up @@ -356,8 +356,8 @@ def __eq__(self, other):
def fromTable(cls, table):
# Docstring inherited from base classs
cls._check_cols(['amp_name', 'wavelength', 'efficiency'], table)
return cls(table['amp_name'], table['wavelength'].quantity,
table['efficiency'].quantity, table.meta)
return cls(table['amp_name'], table['wavelength'],
table['efficiency'], table.meta)

def toTable(self):
# Docstring inherited from base classs
Expand All @@ -381,7 +381,7 @@ def toTable(self):
names = numpy.concatenate([names, numpy.full(val[0].shape, amp_name)])
names = numpy.array(names)
# Note that in future, the astropy.unit should make it through concatenation
return Table({'amp_name': names, 'wavelength': wavelength*wunit, 'efficiency': efficiency*eunit},
return QTable({'amp_name': names, 'wavelength': wavelength*wunit, 'efficiency': efficiency*eunit},
meta=self.metadata)

def evaluate(self, detector, position, wavelength, kind='linear'):
Expand Down

0 comments on commit 1655b74

Please sign in to comment.