Skip to content

Commit

Permalink
updating vac test example
Browse files Browse the repository at this point in the history
  • Loading branch information
havok2063 committed Jun 22, 2018
1 parent 62f91ca commit 3acf3ee
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
10 changes: 5 additions & 5 deletions python/marvin/contrib/vacs/base.py
Expand Up @@ -6,7 +6,7 @@
# @Author: Brian Cherinka
# @Date: 2018-06-21 17:01:09
# @Last modified by: Brian Cherinka
# @Last Modified time: 2018-06-22 11:22:39
# @Last Modified time: 2018-06-22 12:08:48

from __future__ import print_function, division, absolute_import
import abc
Expand All @@ -20,10 +20,10 @@
class VACMixIn(object, six.with_metaclass(abc.ABCMeta)):
''' This mixin allows for integrating a VAC into Marvin '''

@abc.abstractmethod
def _get_from_file(self):
''' This method controls accessing a VAC from a local file '''
pass
# @abc.abstractmethod
# def _get_from_file(self):
# ''' This method controls accessing a VAC from a local file '''
# pass

def download_vac(self, name=None, **path_params):
"""Download the VAC using rsync """
Expand Down
23 changes: 18 additions & 5 deletions python/marvin/contrib/vacs/dapall.py
Expand Up @@ -6,21 +6,34 @@
# @Author: Brian Cherinka
# @Date: 2018-06-21 15:13:07
# @Last modified by: Brian Cherinka
# @Last Modified time: 2018-06-21 19:08:03
# @Last Modified time: 2018-06-22 12:12:08

from __future__ import print_function, division, absolute_import

from marvin.contrib.vacs.base import VACMixIn
from sdss_access.path import Path
from astropy.io import fits
from astropy.table import Table


class DapVAC(VACMixIn):

def _get_from_file(self):
self._filename = Path().full('dapall', dapver='2.1.3', drpver='v2_3_1')

@property
def dap_vac_row(self):
return {'ddapvac': 'dfdf', 'stuff': self.plateifu}
''' Return a single row from the DAPall file for a given plateifu '''

# get the full path
vac_filename = Path().full('dapall', dapver=self._dapver, drpver=self._drpver)

# open the DAPall file
hdu = fits.open(vac_filename)
dapall_table = Table(hdu[1].data)

daptype = self.bintype.name + '-' + self.template.name

dapall_row = dapall_table[(dapall_table['PLATEIFU'] == self.plateifu) &
(dapall_table['DAPTYPE'] == daptype)]

return dapall_row


6 changes: 1 addition & 5 deletions python/marvin/contrib/vacs/vactest.py
Expand Up @@ -6,18 +6,14 @@
# @Author: Brian Cherinka
# @Date: 2018-06-21 18:57:07
# @Last modified by: Brian Cherinka
# @Last Modified time: 2018-06-21 19:07:00
# @Last Modified time: 2018-06-22 14:00:02

from __future__ import print_function, division, absolute_import
from marvin.contrib.vacs.base import VACMixIn
from sdss_access.path import Path


class TestVAC(VACMixIn):

def _get_from_file(self):
self._filename = Path().full('dapall', dapver='2.1.3', drpver='v2_3_1')

@property
def test_vac_row(self):
return {'testvac': 'this is a test'}
Expand Down

0 comments on commit 3acf3ee

Please sign in to comment.