Tellurium Plugins
Python Wrapper for Tellurium Plugins
 All Data Structures Functions Properties Groups Pages
telCreateNoisyData.py

This example demonstrates the use of the AddNoise plugin

createNoisyData_output.jpg
Image output using the example below.
1 #-------------------------------------------------------------------------------
2 # Purpose: Example demonstrating how to add noise to Tellurium data using the
3 # AddNoise plugin. This example also shows how to save the data to a file.
4 #
5 # Author: Totte Karlsson (totte@dunescientific.com)
6 #-------------------------------------------------------------------------------
7 import teplugins as tel
8 
9 try:
10  modelPlugin = tel.Plugin("tel_test_model")
11  noisePlugin = tel.Plugin("tel_add_noise")
12 
13  #Generate internal test data
14  modelPlugin.execute()
15  test_data = modelPlugin.TestData
16 
17  test_data.plot()
18  # Assign the dataseries to the plugin inputdata
19  noisePlugin.InputData = test_data
20 
21  # Set parameter for the 'size' of the noise
22  noisePlugin.Sigma = 8.e-6
23 
24  # Add the noise
25  noisePlugin.execute()
26 
27  # Get the data to plot
28  noisePlugin.InputData.plot()
29 
30  #Write the data to file
31  noisePlugin.InputData.writeDataSeries("testData.dat")
32 
33 except Exception as e:
34  print 'Problem: ' + `e`