Coverage for marshallEngine/feeders/ztf/data.py : 0%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1#!/usr/local/bin/python
2# encoding: utf-8
3"""
4*import the ZTF stream into the marshall*
6:Author:
7 David Young
8"""
9import sys
10import os
11os.environ['TERM'] = 'vt100'
12from fundamentals import tools
13from ..data import data as basedata
14from astrocalc.times import now
15from fundamentals.mysql import writequery
18class data(basedata):
19 """
20 *Import the ZTF transient data into the marshall database*
22 **Key Arguments**
24 - ``log`` -- logger
25 - ``dbConn`` -- the marshall database connection
26 - ``settings`` -- the settings dictionary
29 **Usage**
31 To setup your logger, settings and database connections, please use the ``fundamentals`` package (`see tutorial here <http://fundamentals.readthedocs.io/en/latest/#tutorial>`_).
33 To initiate a data object, use the following:
35 ```python
36 from marshallEngine.feeders.ztf.data import data
37 ingester = data(
38 log=log,
39 settings=settings,
40 dbConn=dbConn
41 ).ingest(withinLastDays=withInLastDay)
42 ```
44 """
45 # Initialisation
47 def __init__(
48 self,
49 log,
50 dbConn,
51 settings=False,
52 ):
53 self.log = log
54 log.debug("instansiating a new 'data' object")
55 self.settings = settings
56 self.dbConn = dbConn
58 self.fsTableName = "fs_ztf"
59 self.survey = "ZTF"
61 # xt-self-arg-tmpx
63 return None
65 def ingest(
66 self,
67 withinLastDays):
68 """*Ingest the data into the marshall feeder survey table*
70 **Key Arguments**
72 - ``withinLastDays`` -- within the last number of days. *Default: 50*
74 """
75 self.log.debug('starting the ``ingest`` method')
77 allLists = []
79 sqlQuery = """call update_fs_ztf()""" % locals()
80 writequery(
81 log=self.log,
82 sqlQuery=sqlQuery,
83 dbConn=self.dbConn
84 )
86 # self._import_to_feeder_survey_table()
87 self.insert_into_transientBucket()
89 # CLEAN UP TASKS TO MAKE THE TICKET UPDATE
90 self.clean_up()
92 self.log.debug('completed the ``ingest`` method')
93 return None