...
1) Take XY data, and return XY data converting data to noise
Code Block |
---|
language | py |
---|
linenumbers | true |
---|
collapse | true |
---|
|
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 |
...
3) Take small angle scattering
vs data and I vs q data and transform this to produce a Guinier plot (
click here to download)
...
4) Take small angle scattering
vs data and I vs q data and transform this to produce a Kratky plot (
click here to download)
...
Code Block |
---|
|
# Example script for use with the 'Python Script - XY to XY [Scripting]' processing plug-in.
#
# Last updated 2016-11-02 - For DAWN 2.3
#
# Copyright (c) 2016 Diamond Light Source Ltd.
#
#
# The DAWN Python PyDev actor will execute this script, invoking a 'run' method in this file.
# This actor will pass the data and any associated variables from the dataset, which we will
# catch as a dictionary.
#
# Below is a simple example where reduced SAXS data is taken in and converted to display a Kratky plot
# Always handy to have numpy
import numpy as np
# The method the the PyDev actor will call, we'll catch any and all arguements as a dictionary
def run(**kwargs):
# Extract out the data and xaxis from the dictionary
data = kwargs['data']
xaxis = kwargs['xaxis']
# Do some 'error' handling
if 'error' in kwargs:
del kwargs['error']
# Do the required mathematics on the data
kratky = np.power(xaxis,2)*data
# Set the plot titles and data values
kwargs['data_title'] = 'I*q^2'
kwargs['data'] = kratky
kwargs['xaxis_title'] = 'q'
return kwargs |
5) Take small angle scattering
vs scattering I vs q data and transform this to produce a Porod plot (
click here to download)
...