Python

  • You do not have permissions to view this page - please try logging in.
Table of contents
You are currently comparing two old versions - only when you are comparing against the latest version can you revert. Return to version archive.

Combined revision comparison

Comparing version 22:55, 15 Jul 2018 by aduarte with version 10:08, 16 Jul 2018 by aduarte.

...

Get data

NOTE: The unique identifiers are CASE-SENSITIVE

The returned data structure gives you information about:

  • start time
  • end time
  • time of the event
  • mime_type
  • the parameter unique identifier

Import extra libraries

import numpy
import matplotlib.pyplot as plt

Data for only one parameter

dataStructArray=client.getData('POST.PROCESSED.DENSITY','0x0000', 17898)
dataStruct=dataStructArray[0]
density=dataStruct.getData()
tstart = dataStruct.getTStart()
tend = dataStruct.getTEnd()

Calculate the time between samples

tbs = (tend.getTimeInMicros() - tstart.getTimeInMicros())/len(density)

Get the events  associated with this data

events = dataStruct.get('events')

The event time (I’m assuming the event I want is at the index 0, but I should check first...)

tevent = TimeStamp(tstamp=events[0].get('tstamp'))

The delay of the start time relative to the event time

delay = tstart.getTimeInMicros() - tevent.getTimeInMicros()

Finally create the time array

times = numpy.linspace(delay,delay+tbs*(len(density)-1),len(density))

And plot the data

plt.plot(times, density); plt.show()

Version from 22:55, 15 Jul 2018

This revision modified by aduarte (Ban)

...

Version as of 10:08, 16 Jul 2018

This revision modified by aduarte (Ban)

...

Get data

NOTE: The unique identifiers are CASE-SENSITIVE

The returned data structure gives you information about:

  • start time
  • end time
  • time of the event
  • mime_type
  • the parameter unique identifier

Import extra libraries

import numpy
import matplotlib.pyplot as plt

Data for only one parameter

dataStructArray=client.getData('POST.PROCESSED.DENSITY','0x0000', 17898)
dataStruct=dataStructArray[0]
density=dataStruct.getData()
tstart = dataStruct.getTStart()
tend = dataStruct.getTEnd()

Calculate the time between samples

tbs = (tend.getTimeInMicros() - tstart.getTimeInMicros())/len(density)

Get the events  associated with this data

events = dataStruct.get('events')

The event time (I’m assuming the event I want is at the index 0, but I should check first...)

tevent = TimeStamp(tstamp=events[0].get('tstamp'))

The delay of the start time relative to the event time

delay = tstart.getTimeInMicros() - tevent.getTimeInMicros()

Finally create the time array

times = numpy.linspace(delay,delay+tbs*(len(density)-1),len(density))

And plot the data

plt.plot(times, density); plt.show()
Powered by MindTouch Core