Plots
This module gather plotting functions for GRIP tools.
- plots.plot_diag_nonspectral_data(data_xy, labels, save_path, save_name, markers=['.', '-', '-'], save_fig=True)
Plot non spectral data.
Different datasets can be put on the same subplot with the same or different markers.
Parameters
- data_xynested tuples of shape (N, k, w, 2)
Data to plot, N is the number of different markers, k is the number of dataset to plot with the same marker, w is te number of spectral channels (equal to the number of subplots), 2 is the number of elements in the smallest tuple (x and y data).
- labelsnested tuples of shape (N, k)
Labels for each plot.
- save_pathstring
Path where to save.
- save_namestring
Name under which the figures are saved.
- markerslist of shape (N,), optional
List of markers for all the dataset per subplot. The default is [‘.’, ‘-’, ‘-‘].
- save_figbool, optional
Save the figure or not. The default is True.
Raises
- TypeError
Check if the sizes of
data_xy
,markers
andlabels
are consistent.
Returns
None.
- plots.plot_diag_spectral_data(nb_rows_plot, wl_scale, data_xy, labels, save_path, save_name, markers=['.', '-', '-'], save_fig=True)
Plot spectral data (one subplot per spectral channel). Each figure has a maximum number of subplots; several figures are generated if needed. Subplots layout is 2-column of a user-specified number of rows. The figures are saved in separate file, the name filed are index by the last wavelength displayed in the figure.
Different datasets can be put on the same subplot with the same or different markers.
Parameters
- nb_rows_plotint
Number of rows in a figure instance.
- wl_scale1d-array
Wavelength scale of the null depths.
- data_xynested tuples of shape (N, k, w, 2)
Data to plot, N is the number of different markers, k is the number of dataset to plot with the same marker, w is te number of spectral channels (equal to the number of subplots), 2 is the number of elements in the smallest tuple (x and y data).
- labelsnested tuples of shape (N, k)
Labels for each plot.
- save_pathstring
Path where to save.
- save_namestring
Name under which the figures are saved.
- markerslist of shape (N,), optional
List of markers for all the dataset per subplot. The default is [‘.’, ‘-’, ‘-‘].
- save_figbool, optional
Save the figure or not. The default is True.
Raises
- TypeError
Check if the sizes of
data_xy
,markers
andlabels
are consistent.
Returns
None.
- plots.plot_null_distributions(nb_rows_plot, wl_scale, text, null_axis, null_pdf, null_pdf_err, save_path, save_name, model=None, save_fig=True)
Plot the null distributions. There is one subplot per spectral channel. Each figure has a maximum number of subplots; several figures are generated if needed. Subplots layout is 2-column of a user-specified number of rows. The figures are saved in separate file, the name filed are index by the last wavelength displayed in the figure.
Parameters
- nb_rows_plotint
Number of rows in a figure instance.
- wl_scale1d-array
Wavelength scale of the null depths.
- textstring
Information to add on the plot, such as the values of the fitted parameters.
- null_axis2d-array (wavelength, nb of bins)
x-axes of the histograms.
- null_pdf2d-array (wavelength, nb of bins)
Histograms of the null depths.
- null_pdf_err2d-array (wavelength, nb of bins)
Error bars on the histograms of the null depths.
- model1d- or 2d-array (wavelength, nb of bins), optional
Model of the histograms. If
None
, the model is not plotted. The default is None.- save_pathstring
Path where to save.
- save_namestring
Name under which the figures are saved.
- save_figbool, optional
Save the figure or not. The default is True.
Returns
None.
- plots.plot_parameter_space_2d(param_map, mapx, mapy, mapz, arg_axes, stepx, stepy, labelx, labely, labelz, text, save_path, x_id, y_id, basin_hopping_count, wl_min, wl_max, save, valminmax=None)
Plot n-parameter spaces with heatmaps. It can only display along with the first 3 axes, all extra ones are sliced. The 3rd axis is displayed along several subplots of the two other axes. The maximum number of subplot is 10, and a single figure instance is displayed. The subplots display the +/- 5 values around the value indexed by
argz
. If the z-axis has less than 10 points, they are all displayed in the instance.Parameters
- param_mapnd-array
Map of the parameter space (chi2, likelihood…).
- mapx1d-array
Scale of the parameter to display along the x-axis of the heatmap.
- mapy1d-array
Scale of the parameter to display along the y-axis of the heatmap.
- mapz1d-array
Scale of the parameter to display along the z-axis (subplot) of the heatmap..
- arg_axesint or iterable
Index of the remaining axes that are sliced. If it is an interger, it is the extremum of the heat map to center the display of the z-axis, and the map must have 3 axes. If it is an iterable, the first element must be the slice along the z-axis, ad the map must have 4 axes or more.
- stepxfloat
Step size of the x-axis scale.
- stepyfloat
Step size of the y-axis scale.
- labelxstring
Label of the x-axis.
- labelystring
Label of the y-axis.
- labelzstring
Label of the title of the subplot.
- textstring
Title of the plot and element in the naming of the saved file. Can be the name of the baseline for instance.
- save_pathstring
Path to the folder where the plot is saved.
- x_idstring
Name of the x-axis.
- y_idstring
Name of the y-axis.
- basin_hopping_countint
ID number of the basin hopping.
- wl_minfloat
Minimum wavelength value.
- wl_maxfloat
Maximum wavelength value.
- savebool
Set to
True
to save the plot.- valminmaxtuple-like, optional
Set the minimum and maximum values of the dynamic range of the heatmap. The shape is (min value, max value). If
None
, the dynamics is set according to the minimum and maximum value of the whole array. The default is None.
Returns
None.
Notes
For heatmap of 2 axes, an artificial 3rd one must be created to use this function.