Phase space class for dimensionless equations¶
-
class
non_dimensional.
phase_space
[source]¶ Phase space object performing a parameter span for a (custom) pair of parameters using dimensionless form of equations
-
get_initial
()[source]¶ Calculate initial condition for the simulation.
If the parameter self.recalculate_initial is True, then the initial condition is recalculated, as defined in the simulation class.
If it’s False, then the previous initial condition is utilized**
Returns:
-
get_outname
(out)[source]¶ Defines the labels attributed to the various statistics that are calculated.
Parameters: out – The output matrix from the parameter sweep (e.g. self.rel_height) Returns: Label (str) (e.g. r”$Delta e$”)
-
get_stats
(X)[source]¶ Perform the simulation (with repeats as defined by the np.int self.rep), and calculate the summary statistics: the relative height (∆e), the amount (int e dx), the polarization timescale, and the number of peaks.
Parameters: X – Two-element list or array defining the values of the parameters attributed to the x or y axis Returns: Four-element array of the statistics, as defined by the order listed above.
-
make_param_span_plot
(ax, out, xscale='log', yscale='log', percentile_lim=(0, 100), cmap=<sphinx.ext.autodoc.importer._MockObject object>, overlay_peaks=False, vlim=None)[source]¶ Plot the parameter scan.
Parameters: - ax – matplotlib axis object to plot the parameter scan onto.
- out – np.ndarray of statistics for each parameter combination (resolution x resolution). E.g. self.rel_height
- xscale – Scale of the x-axis. Must be the same as in self.perform_param_scan.
- yscale – Scale of the y-axis. Must be the same as in self.perform_param_scan.
- percentile_lim – Cut-off for the colorbar, setting the maximum and minimum percentile of the statistic for which a color is attributed.
- cmap – matplotlib.cm object e.g. matplotlib.cm.plasma
- overlay_peaks – Overlay the number of peaks for each parameter combination (i.e. to identify multi-peak regimes).
-
overlay_peaks
(ax)[source]¶ Overlay the number of peaks. Transparent if 1 or 0 peaks, or increasingly black if multi-peak solutions are frequent.
Parameters: ax – matplotlib axis object Returns: ax
-
perform_param_scan
(xlim, ylim, xscale, yscale, resolution, xvar='lambd', yvar='epsilon', recalculate_initial=True)[source]¶ Perform the parameter scan.
Saves the parameter-scan to an npy file.
Uses the joblib parallelisation package.
Parameters: - xlim – Tuple, setting the minimum and maximum of the xvar to simulate over. If xlim = (a,b), (where a < b) then if xscale is “log”, simulate between 10^a and 10^b if xscale is “reciprocal”, simulate between 1/b and 1/a if xscale is “normal”, then simulate between a and b
- ylim – Tuple, setting the minimum and maximum of the yvar to simulate over. Same rules as xvar
- xscale – Scale of the x-axis, setting the stepping of the parameter discretization. A str: either “log”, “reciprocal” or “normal”
- yscale – Scale of y-axis. Same rules as xscale.
- resolution – Number of parameter discretisations to simulate over. Can be an np.int32, where paramter discretisation number is same in x and y axis, or a tuple of np.int32, defining the number of spatial discretisations for the x vs y axis
- xvar – str defining the x-axis attributed parameter. Must match nomencalture of the code precisely. e.g. “D_E”
- yvar – str defining the y-axis attributed parameter. Must match nomencalture of the code precisely. e.g. “E_crit”
- recalculate_initial – Recalculate the initial condition of the simulation for each repeat and each parameter combination if True. Else the first initial condition is stored and re-used.
-
plot_param_scan
(out, xscale='log', yscale='log', percentile_lim=(0, 100), cmap=<sphinx.ext.autodoc.importer._MockObject object>, overlay_peaks=False, save=True, vlim=None)[source]¶ Make full parameter scan plot. A wrapper for self.make_param_span_plot.
Saves the plot to the plots directory as a PDF.
Parameters: - out – np.ndarray of statistics for each parameter combination (resolution x resolution). E.g. self.rel_height
- xscale – Scale of the x-axis. Must be the same as in self.perform_param_scan.
- yscale – Scale of the y-axis. Must be the same as in self.perform_param_scan.
- percentile_lim – Cut-off for the colorbar, setting the maximum and minimum percentile of the statistic for which a color is attributed.
- cmap – matplotlib.cm object e.g. matplotlib.cm.plasma
- overlay_peaks – Overlay the number of peaks for each parameter combination (i.e. to identify multi-peak regimes).
-