fusion-flap / flap

Fusion Library of Analysis Programs
MIT License
11 stars 5 forks source link

Using flap.Intervals object in flap.plot slicing can fail if 'step' and 'number' is set. #11

Open abencze opened 5 years ago

abencze commented 5 years ago

import numpy as np import flap import matplotlib.pyplot as plt

t = flap.Coordinate( name='Time', mode=flap.CoordinateMode(equidistant=True), unit = 'Second',# Here the unit is NOT a Unit class object. shape=(1000), start=0, step=1, dimension_list=[1] ) ch = flap.Coordinate( name='Channel number', mode=flap.CoordinateMode(equidistant=True), shape=(3), start = 1, step=1, dimension_list=[0]) ch_name = flap.Coordinate( name='Signal name', mode=flap.CoordinateMode(equidistant=False), shape=(3), values = ['CH-1','CH-2','CH-3'], dimension_list = [0] ) dunit = flap.Unit(name='Amplitude',unit='V')

create a random array as data

data = np.random.randn(3,1000)

create a flap data object instace

d = flap.DataObject(data_array = data, data_unit = dunit,# Here the unit IS a Unit class object. coordinates = [t,ch,ch_name], data_title = 'Random series', exp_id = '17062019_01' )

interv = flap.Intervals(0,100,step=100,number=1) d.plot(axes='Time',slicing={'Signal name':'CH-1','Time':interv})