Plotting#
- pyscan.plotting.basic_plots.average_plot1D(expt, **kwarg)#
Wrapper for 1D plot to plot the average over the second dimension
- Other Parameters:
- **kwargs
Additional kwargs are pyscan.plotting.plotgenerator.PlotGenerator properties.
- pyscan.plotting.basic_plots.average_plot2D(expt, **kwarg)#
Wrapper for 1D plot to plot the average over the second dimension
- Other Parameters:
- **kwargs
Additional kwargs are pyscan.plotting.plotgenerator.PlotGenerator properties.
- pyscan.plotting.basic_plots.mean1D(data)#
Returns mean of data over dim 1
- pyscan.plotting.basic_plots.mean2D(data)#
Returns mean of data over dim 2
- pyscan.plotting.basic_plots.plot1D(expt, **kwarg)#
Function to generate a simple 2D plot
- Parameters:
- expt
The experiment object
- d
Dimensionality of the data to be plotted
- Other Parameters:
- **kwargs
Additional kwargs are pyscan.plotting.plotgenerator.PlotGenerator properties.
- pyscan.plotting.basic_plots.plot2D(expt, **kwarg)#
Function to generate a simple 2D plot
- Parameters:
- expt
The experiment object
- d
Dimensionality of the data to be plotted
- Other Parameters:
- **kwargs
Additional kwargs are pyscan.plotting.plotgenerator.PlotGenerator properties.
- pyscan.plotting.live_plot.live_plot(plotting_function, dt=1)#
Generates a function that executes plotting_function while data is still being taken in Jupyter notebooks. Used by the live plotting functions such as
live_plot2D().- Parameters:
- plotting_functionfunc
Function to be refreshed
- dtfloat
Time in s between refreshes
- Returns:
- func
- pyscan.plotting.oscilloscope.oscilloscope(measure_function, histo_range=100, dt=0.001)#
Takes a function that returns a value and plots live until function is killed
- Parameters:
- measure_functionfunc
Function that generates a data point or set
- histo_rangeint
Total number of data points before overwriting
- dtfloat
Time in s between datapoints being taken
- normalize_max
normalize maximum of data to 1
- Returns:
- None
- class pyscan.plotting.plot_generator.PlotGenerator(expt, d, **kwarg)#
Helper class to generate standarized figures
- Parameters:
- expt
The experiment object
- d
Dimensionality of the data to be plotted
- x_nameoptional
User choice of x_data, otherwise defautls to first valid
- x_rangeoptional
User choice of x_range, otherwise default
- y_nameoptional
User choice of y_data, otherwise defautls to first valid
- y_rangeoptional
User choice of y_range, otherwise default
- data_nameoptional
User choice of data, otherwise defautls to first valid
- data_rangeoptional
User choice of y range (2D) or vertical range (3D), otherwise default
- index3Doptional
If data is 3D and plot is 2D, choose slice, otherwise 0
- analysis_functionoptional
Analysis to perform on data, otherwise, returns data
- analysis_argstuple, optional
If analysis dependes on multipled datasets, will apply analysis function to these datasets
Methods
get_data()Gets the data to be plotted
Finds the min, max range of the data values for the plot
Generates the title of the plot
get_x()Finds the x data for plotting
Generates label for x-axis of plot
Finds the min, max range of the x-values for the plot
get_y()Gets data for y axis fo plot
Generates label for y-axis of plot
Finds the min, max range of the y-values for the plot
key_or_none(key, kwarg)Sets attribute on PlotGenerator object if key is in kwarg
- get_data()#
Gets the data to be plotted
- get_data_range()#
Finds the min, max range of the data values for the plot
- get_title()#
Generates the title of the plot
- get_x()#
Finds the x data for plotting
- get_xlabel()#
Generates label for x-axis of plot
- get_xrange()#
Finds the min, max range of the x-values for the plot
- get_y()#
Gets data for y axis fo plot
- get_ylabel()#
Generates label for y-axis of plot
- get_yrange()#
Finds the min, max range of the y-values for the plot
- key_or_none(key, kwarg)#
Sets attribute on PlotGenerator object if key is in kwarg
- Parameters:
- key
possible input
- kwarg
kwargs from __init__
- Returns:
- None
- class pyscan.plotting.jupyter_tools.JupyterTools#
Utility class for loading plotting data in jupyter notebooks
- Attributes:
- path_namestr
Path to datasets, defaults to ‘./’.
- default_zstr
Default name of data, defaults to ‘x’.
- default_vrangelist of length 2
default z range of 3D plots, defaults to [-0.02, 0.02].
- plot_size
plot size. defaults to None.
Methods
Finds most recent dataset in self.path_name
Loads last dataset in self.path_name
load_next_cell(*arg, **kwarg)Generates a new jupyter cell with function and dataname in function
- get_last_scan_name()#
Finds most recent dataset in self.path_name
- load_last_scan()#
Loads last dataset in self.path_name
- Returns:
- ItemAttribute
- load_next_cell(*arg, **kwarg)#
Generates a new jupyter cell with function and dataname in function
- Parameters:
- function_name
funciton to be applied to data
- Returns:
- None
- Other Parameters:
- *arg, **kwarg
arguments to be passed to function_name