示例#1
0
文件: test.py 项目: twist/diaGrabber


#class test:
	
	#def __init__(self):
from diaGrabber import source, target, plot
from diaGrabber.methods import merge, calc, exclude, transform

#folder = "/home/bedrich/Arbeitsfläche/Strahlvermessung/"
folder = "/home/bedrich/Dokumente/HiWi/Strahlvermessung/"

file_name = "test.txt"#"
seperator = " "
data_type = "float"
f = source.plainText(folder, file_name, seperator, data_type)
f.readout_every_n_line = 10


I = f.mergeDimension("I [mA]",1)
#I.transform =  transform.fx("x*1e-3", "I [A]")

I2 = f.mergeDimension("I2 [mA]",1,merge.max())
#I.transform =  transform.fx("x*1e-3", "I [A]")

t = f.mergeDimension("time", 0)
t.calc.append(calc.delta(10))

Ux = f.basisDimension("Ux",3,90,[-0.017, 0.01])
#Ux.includeFromTo(-0.4043, 0.4043)#alles
#Ux.calc.append(calc.delta(100))
示例#2
0
# to know where you are in the procedure, I will tag this positions like this:
###################
######(SEE?)#######
###################

# at first some business as usual: we import everything that we need from diaGrabber
from diaGrabber import source, target, plot
from diaGrabber.source.methods import merge, calc, exclude, transform

# our file is located in ressources/, each dimension is seperated with a space
# the values are of type float (something like 1.23)
f= source.plainText(
	folder="ressources",
	file="large.txt",
	dimSeperator=" ",
	dataType="float",
	#using the following attribute we avoid the (maybe time-expensive)
	#counting of lines:
	nFileLines=40000
	)


# this file is the result of a simulation of a 2d-scan of an electron-beam (eBeam)

# in the file is a timestamp the the beginning of each line:
time=f.mergeDimension(name="time",unit="s",index=0)
# the eBeam scans with a triangle-wave over a substrate
# therefore it moves in x-direction with a simple linear ramp-function
ramp = f.basisDimension(name="ramp",unit="V", index=1, resolution=300)
# and in y-direction with a triangle-function
triangle = f.basisDimension(name="triangle",unit="V",index=2, resolution=300)
## have a look at diaGrabber/examples/ressources/timeFolders
## here you will find hundreds of folders. in every folder is a file called
## "line5_T.xy". it include values of a distance and a temperature
## the folders itself represents different time-values
########################################################

## at first we import everything we need from diaGrabber
from diaGrabber import source, target, plot
from diaGrabber.source.methods import merge, calc, exclude, transform

## we create a instance of a plainText-source
f= source.plainText(
	folder="ressources/timeFolders",
	file="line5_T.xy",
	dimSeperator=" 	",
	dataType="float",
	## we don't want to see the statusbar for every file, so we set:
	silentReadout=True
	## if you want to have a message for every new file readout, set
	## silentReadout to False
	)

## if we dont want to do further work on the dimensions itself we dont have to
##  write x = source.xDimension - just calling the method is enough
f.basisDimension(name="distance",unit="m", index=0, resolution=300)
f.mergeDimension(name="Temperature",unit="K",index=1)

## here comes the new part: the folders in the main 'timeFolder' will
## represent a basisDimension. trough defining index='folder'
## if you have a nested system of folders you can add further basisDimensions
## like the following. in this case the order of reference builds the folder-system
f.basisDimension(name="time",unit="s",index="folder", resolution=300)