Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Python scripting processing examples:

Take XY data, and return XY data - convert data to noise

 

import numpy as np

def run(xaxis, data, **kwargs):
	#generate random noise the same shape as the data
	noise = np.random.rand(*data.shape)
	#add it to the output dictionary
	script_outputs = {"data":noise}
	#also return the x-axis
	script_outputs["xaxis"] = xaxis
	return script_outputs

 

Take an image (with axes) and return an image (with axes)

 

import numpy as np

def run(xaxis,yaxis, data, **kwargs):
    #generate random noise the same shape as the data
    noise = np.random.rand(*data.shape)
    #add it to the output dictionary
    script_outputs = {"data":noise}
    #also return the x-axis
    script_outputs["xaxis"] = xaxis
	#and the y-axis
    script_outputs["yaxis"] = yaxis

    return script_outputs

 

 

import numpy as np

 

def run(xaxis,yaxis, data, **kwargs):

    #generate random noise the same shape as the data

    noise = np.random.rand([data.shape[1]])

    #add it to the output dictionary

    script_outputs = {"data":noise}

    #also return the x-axis

    script_outputs["xaxis"] = xaxis

    return script_outputs
  • No labels