def test_getHistHS_goodTag(self): tag_name = "MDSSCSC1.ANVDD.ADE1C1PA" start_time = "01/23/17" end_time = "01/24/17" df = dna.GetHist(tag_name, start_time, end_time, high_speed=True) good_val = np.array([0, 0, 1, -1, 1, 721]) test_val = df["MDSSCSC1.ANVDD.ADE1C1PA"].values[0:6] self.assertEqual(good_val.all(), test_val.all())
def test_getHist_label(self): tag_name = "MDSSCSC1.ANVCALC.ADE1CA02" start_time = "01/09/17 02:00:00" end_time = "01/09/17 02:00:30" df = dna.GetHist(tag_name, start_time, end_time, label="NEW") good_val = ['NEW', 'NEW Status'] test_val = list(df.columns.values) self.assertEqual(good_val, test_val)
def test_getHist_descAsLabel(self): tag_name = "MDSSCSC1.ANVCALC.ADE1CA02" start_time = "01/09/17 02:00:00" end_time = "01/09/17 02:00:30" df = dna.GetHist(tag_name, start_time, end_time, desc_as_label=True) good_val = ['ADE1 Percent Load', 'ADE1 Percent Load Status'] test_val = list(df.columns.values) self.assertEqual(good_val, test_val)
def test_getHist_goodTag(self): tag_name = "MDSSCSC1.ANVCALC.ADE1CA02" start_time = "01/09/17 02:00:00" end_time = "01/09/17 02:00:30" exp_val = np.array([74.3, 71.3, 70.7, 72.2, 72.2]) df = dna.GetHist(tag_name, start_time, end_time) test_val = df["MDSSCSC1.ANVCALC.ADE1CA02"].values self.assertEqual(exp_val.all(), test_val.all())
def test_getHist_badTag(self): tag_name = "GIBBERISH.DOESNOT1.EXIST123" start_time = "01/02/17 01:58" end_time = "01/02/17 02:00" df = dna.GetHist(tag_name, start_time, end_time) self.assertTrue(df.empty)
# -*- coding: utf-8 -*- import pandas as pd import pyedna.ezdna as dna # The following code will pull snap data from TESTPNT1 over a 30-second interval: tag = "TESTSITE.TESTSERVICE.TESTPNT1" # format site.service.tag start = "12/01/16 01:01:01" # format mm/dd/yy hh:mm:ss end = "01/03/17 01:01:01" # format mm/dd/yy hh:mm:ss period = "00:00:30" # format hh:mm:ss df = dna.GetHist(tag, start, end, period=period, mode="snap") # Raw data may be obtained from TESTPNT1 using: df2 = dna.GetHist(tag, start, end) # Other supported pull types include Average, Interpolated, Max, and Min. Please # refer to eDNA documentation for more description about these pull types. # Multiple tags can be pulled (in Raw mode) at the same time using: tags = [ "TESTSITE.TESTSERVICE.TESTPNT1", "TESTSITE.TESTSERVICE.TESTPNT2", "TESTSITE.TESTSERVICE.TESTPNT3", "TESTSITE.TESTSERVICE.TESTPNT4" ] df3 = dna.GetMultipleTags(tags, start, end) # A list of connected services may be obtained using GetServices: services = dna.GetServices()