scifysim.plot_tools module

scifysim.plot_tools.getcolor(index, tracelength=None)[source]

Converts an index to one of the basic colors of matplotlib

scifysim.plot_tools.getcolortrace(cmap, value, length, alpha=None)[source]
scifysim.plot_tools.make_cursor(loc, size, extent=None, color='k', flipy=True, **kwargs)[source]
scifysim.plot_tools.piston2size(piston, dist=140.0, psz=8.0, usize=150.0)[source]

Pretty visualization of projected array: Emulates perspective

Arguments:

  • dist : The distance of the observer to the array

  • psz : The diameters of the pupils

  • usize : A scaling parameter default = 150

scifysim.plot_tools.plot_colored_uv(asim, title='Plot of the uv coverage', show=True, figsize=None, dpi=100, **kwargs)[source]
scifysim.plot_tools.plot_corrector_tuning_angel_woolf(corrector, lambs, combiner, wv_model=None, out_label=None, show=True, maskout=[2, 6])[source]

Plots some information on the tuning of the combiner using geometric piston and chromatic corrector plates.

Arguments:

  • corrector : A corrector object

  • lambs : The wavelengths to plot [m]

  • combiner : A combiner object

  • wv_model : A wate vapor model (wet_atmo) to display along

  • show : Whether to call plt.show

  • out_label : A list of output labels to pass to

Plots:

  • Nulling contrast (before and after correction)

  • The corrected matrix matrix plot

  • The length of correction, compensation, and offset

  • Shape excursion (before and after correction)

Currently works only with lambda_science_range

scifysim.plot_tools.plot_differential_map(asim, kernel=None, wavelength=None, sequence_index=None, show=True, save=False, layout=None, figsize=(12, 3), dpi=100, central_marker=True, cbar=False, return_difmaps=False, use_precomputed=False, **kwargs)[source]

Plot the differential response map of the instrument for the target and sequence

Arguments:

  • asim : simulator object. The simulator must contains self.maps

  • kernel : A kernel matrix indicating the output combinations to take. defaults to None which uses the asim.combiner.K matrix.

  • wavelength : np.ndarray containing wl indices (if None: use all the wavelength channels)

  • sequence_index : The indices of the sequence to plot

  • show : Whether to call plt.show() for each plot

  • save : either False or a string containing the root of a path like maps/figures_

  • figsize : 2 tuple to pass to plt.figure()

  • dpi : The dpi for the maps

  • **kwargs : Additional kwargs to pass to imshow

  • add_central_marker: Add a marker at the 0,0 location

  • central_marker_size: The size parameter to give the central marker

  • central_marker_type: The type of marker to use

  • use_precomputed: (False) if True, use asim.difmaps pre-computed by extract_difobs_map

returns: fig (, difmaps)

scifysim.plot_tools.plot_injection(theinjector, show=True, noticks=True)[source]

Provides a view of the injector status. Plots the phase screen for each pupil.

scifysim.plot_tools.plot_multiple_maps(maplist, mag, cmap='viridis', show=True, detector='E', layout=(1, 1), single_bar=True, adjust_params=None, fontsize='x-small', titles=None, remove_titles=[], remove_xlabels=[], **kwargs)[source]

Uses matplotlib to show multiple sensitvity maps at a given star magnitude for comparison.

hint:

adjust_params = {"bottom":0.,
                "right":0.9,
                "top":1.,
                "cax":[0.95, 0.1, 0.01, 0.7],# left, bottom, width, height
                "orientation":"vertical",
                "location":"top",
                "tick_fontsize":7}

Parameters: * maplist : a list or array of map objects * mag : The star magnitude * cmap : The colormap to use * detector : The type of detector test: “E” for energy detector

“N” for Neyman-Pearson

  • fontsize : The font size for the titles and captions

  • titles : A list of titles to add to the plots

  • remove_titles: The indices for which to remove titles

  • remove_xlabels: the indices for which to remove xlabels

  • **kwargs : Keyword arguments to pass to plt.figure()

Returns the figure object

scifysim.plot_tools.plot_opds(integ, step_time)[source]

Plots the phase error information collected by the integrator object.

scifysim.plot_tools.plot_output_sources(asim, integ, lambda_range, margins=4, show=True, t_exp=0.0)[source]

Plot the content of all outputs for each of the different sources:

Arguments:

  • integ : An integrator object

  • lambda_range : (array-like) The wavelength of interest. Find it in simulator.lambda_science_range

  • margins : The margins to leave between the spectra of outputs (in number of bar widths)

  • show : (boolean) Whether to call plt.show before returning.

Returns:

  • signalplot: A pyplot figure

scifysim.plot_tools.plot_phasescreen(theinjector, show=True, noticks=True, screen_index=True)[source]
scifysim.plot_tools.plot_projected_pupil(asim, seq_index, grid=False, grid_res=5, compass=True, compass_length=10.0, usize=150.0, dist=140.0, perspective=True, show=True)[source]

Designed as a wrapper around plot_pupil that also handles additional illustration. As a contrast to plot_pupil, plot_projected_pupil takes in a simulator object. The plots are made of the array as seen from the target in meters projected to RA-Dec coordinates.

Arguments:

  • asim : Simulator object

  • seq_index: The index in the observing sequence (This feature may evolve)

  • grid : Whether to plot a grid of ground position

  • grid_res: The number of lines in the grid for each direction

  • compass : Whether to plot a little North and East symbol for direction

  • compoass_length: In meters the length of the compass needles.

scifysim.plot_tools.plot_projected_uv(asim, seq_indices=None, grid=False, grid_res=5, compass=True, compass_length=10.0, usize=150.0, dist=140.0, perspective=True, show=True, dpi=100, legend=True, **kwargs)[source]

Designed as a wrapper around plot_pupil that also handles additional illustration. As a contrast to plot_pupil, plot_projected_pupil takes in a simulator object. The plots are made of the array as seen from the target in meters projected to RA-Dec coordinates.

Arguments:

  • asim : Simulator object

  • seq_indices: The index in the observing sequence (This feature may evolve) if None: the whole sequence is mapped

  • show : Whether to call plt.show before returning

scifysim.plot_tools.plot_pupil(thearray, thepistons=None, psz=8.0, usize=150.0, dist=140.0, perspective=True, compass=None, grid=None, show=True)[source]

Plots the projected

Arguments:

  • dist : The distance of the observer to the array

  • psz : The diameters of the pupils

  • usize : A scaling parameter default = 150

  • perspective: whether to simulate an effect of perspective with the size of the markers

  • compass: A pair of positions indicating the direction of North and East after transformation by the same projection as the array [North_vector[e,n], East_vector[e,n]]

  • grid : Similar to the compass but for a bunch of parallels and meridians [parallels[[e0,n0], [e1, n1], … ], meridians[[e0,n0], [e1, n1], …]]

  • show : whether to call plt.show before returning

Returns:

  • fig : The figure

scifysim.plot_tools.plot_response_map(asim, outputs=None, wavelength=None, sequence_index=None, show=True, save=False, figsize=(12, 3), dpi=100, central_marker=True, layout='h', cbar=False, **kwargs)[source]

Plot the response map of the instrument for the target and sequence

Arguments:

  • asim : simulator object. The simulator must contains self.maps

  • outputs : array-like : An array of outputs for which the maps will be plotted

  • wavelength : np.ndarray containing wl indices (if None: use all the wavelength channels)

  • sequence_index : The indices of the sequence to plot

  • show : Whether to call plt.show() for each plot

  • save : either False or a string containing the root of a path like maps/figures_

  • figsize : 2 tuple to pass to plt.figure()

  • dpi : The dpi for the maps

  • layout : “h” for horizontal array of map, “v” for vertical

  • **kwargs : Additional kwargs to pass to imshow

  • add_central_marker: Add a marker at the 0,0 location

  • central_marker_size: The size parameter to give the central marker

  • central_marker_type: The type of marker to use