def test_getMultiple_descAsLabel(self): tags = ["MDSSCSC1.ANVCALC.ADE1CA02", "MDSSCSC1.ANVCALC.ADE1CA03"] start_time = "01/09/17 02:00:00" end_time = "01/09/17 02:00:30" df = dna.GetMultipleTags(tags, start_time, end_time, desc_as_label=True) good_columns = ["ADE1 Percent Load", "ADE1 Max EGT"] test_columns = list(df.columns.values) self.assertEqual(test_columns, good_columns)
def test_getMultiple_goodTags_resample(self): tags = ["MDSSCSC1.ANVCALC.ADE1CA02", "MDSSCSC1.ANVCALC.ADE1CA03"] start_time = "01/09/17 02:00:00" end_time = "01/09/17 02:00:30" df = dna.GetMultipleTags(tags, start_time, end_time, sampling_rate=5) vals1 = np.array([74.3, 74.3, 71.3, 71.3, 70.7, 70.7, 72.2]) vals2 = np.array([420, 420, 419, 419, 413, 413, 415]) test_val1 = df["MDSSCSC1.ANVCALC.ADE1CA02"].values test_val2 = df["MDSSCSC1.ANVCALC.ADE1CA03"].values self.assertEqual(vals1.all(), test_val1.all()) self.assertEqual(vals2.all(), test_val2.all())
def test_getMultiple_allBadTags(self): tags = ["GIBBERISH.DOESNOT1.EXIST123", "GIBBERISH.DOESNOT1.EXIST125"] start_time = "01/02/17 01:58" end_time = "01/02/17 02:00" df = dna.GetMultipleTags(tags, start_time, end_time) self.assertTrue(df.empty)
def test_getMultiple_oneBadTag(self): tags = ["GIBBERISH.DOESNOT1.EXIST123", "MDSSCSC1.ANVCALC.ADE1CA02"] start_time = "01/02/17 01:58" end_time = "01/02/17 02:00" df = dna.GetMultipleTags(tags, start_time, end_time) self.assertFalse(df.empty)
# 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() # A list of point information for a given service can be found using GetPoints: points = dna.GetPoints("TESTSITE.TESTSERVICE")