@@ -114,6 +114,43 @@ def wavelength_theta_figure(
114114 linewidth : float = 1.0 ,
115115 ** kwargs ,
116116):
117+ '''
118+ Creates a figure displaying a histogram over :math:`\\ theta` and :math:`\\ lambda`.
119+
120+ The input can either be a single data array containing the data to display, or
121+ a sequence of data arrays.
122+
123+ The inputs must either have coordinates called "theta" and "wavelength",
124+ or they must be histograms with dimensions "theta" and "wavelength".
125+
126+ If :code:`wavelength_bins` or :code:`theta_bins` are provided, they are used
127+ to construct the histogram. If not provided, the function uses the
128+ bin edges that already exist on the data arrays.
129+
130+ If :code:`q_edges_to_display` is provided, lines will be drawn in the figure
131+ corresponding to :math:`Q` equal to the values in :code:`q_edges_to_display`.
132+
133+ Parameters
134+ ----------
135+ da : array or sequence of arrays
136+ Data arrays to display.
137+ wavelength_bins : array-like, optional
138+ Bins used to histogram the data in wavelength.
139+ theta_bins : array-like, optional
140+ Bins used to histogram the data in theta.
141+ q_edges_to_display : sequence of float, optional
142+ Values of :math:`Q` to be displayed as straight lines in the figure.
143+ linewidth : float, optional
144+ Thickness of the displayed :math:`Q` lines.
145+ **kwargs : keyword arguments, optional
146+ Additional parameters passed to the histogram plot function,
147+ used to customize colors, etc.
148+
149+ Returns
150+ -------
151+ A Plopp figure displaying the histogram.
152+ '''
153+
117154 if isinstance (da , sc .DataArray ):
118155 return wavelength_theta_figure (
119156 (da ,),
@@ -137,15 +174,14 @@ def wavelength_theta_figure(
137174
138175 if theta_bin is not None :
139176 bins ['theta' ] = theta_bin
140- else :
141- if (
142- 'theta' not in d .dims
143- and 'sample_rotation' in d .coords
144- and 'detector_rotation' in d .coords
145- ):
146- bins ['theta' ] = theta_grid (
147- nu = d .coords ['detector_rotation' ], mu = d .coords ['sample_rotation' ]
148- )
177+ elif (
178+ 'theta' not in d .dims
179+ and 'sample_rotation' in d .coords
180+ and 'detector_rotation' in d .coords
181+ ):
182+ bins ['theta' ] = theta_grid (
183+ nu = d .coords ['detector_rotation' ], mu = d .coords ['sample_rotation' ]
184+ )
149185 hs .append (_reshape_array_to_expected_shape (d , ('theta' , 'wavelength' ), ** bins ))
150186
151187 kwargs .setdefault ('cbar' , True )
0 commit comments