@@ -362,24 +362,22 @@ def get_integrations(self, key, omit_flags=False):
362362
363363 def get_r_params (self ):
364364 """
365- decompress r_params dictionary (so it can be readily used).
366- in a pspecdata object, r_parms are stored as a dictionary
367- with one entry per baseline.
368- In uvpspec, the dictionary is compressed so that a single r_param entry
369- correspondsto multiple baselines and is stored as a json format string.
370- get_r_params() reads the compressed string and returns the dictionary
371- with the format
372- r_params: dictionary with parameters for weighting matrix.
373- Proper fields
374- and formats depend on the mode of data_weighting.
375- data_weighting == 'dayenu':
376- dictionary with fields
377- 'filter_centers', list of floats (or float) specifying the (delay) channel numbers
378- at which to center filtering windows. Can specify fractional channel number.
379- 'filter_half_widths', list of floats (or float) specifying the width of each
380- filter window in (delay) channel numbers. Can specify fractional channel number.
381- 'filter_factors', list of floats (or float) specifying how much power within each filter window
382- is to be suppressed.
365+ Return an `r_params` dictionary.
366+
367+ In a `PSpecData` object, the `r_params` are stored as a dictionary with
368+ one entry per baseline.
369+
370+ In a `UVPSpec` object, the dictionary is compressed so that a single
371+ `r_param` entry correspondsto multiple baselines and is stored as a
372+ JSON format string.
373+
374+ This function reads the compressed string and returns the dictionary
375+ with the correct following fields and structure.
376+
377+ Returns
378+ -------
379+ r_params : dict
380+ Dictionary of r_params for this object.
383381 """
384382 return uvputils .decompress_r_params (self .r_params )
385383
@@ -1776,13 +1774,15 @@ def generate_noise_spectra(self, spw, polpair, Tsys, blpairs=None,
17761774 where scalar is the cosmological and beam scalar (i.e. X2Y * Omega_eff)
17771775 calculated from pspecbeam with noise_scalar = True, integration_time is
17781776 in seconds and comes from self.integration_array and Nincoherent is the
1779- number of incoherent averaging samples and comes from
1780- self.nsample_array. If component is ' real' or ' imag' , P_N is divided by
1781- an additional factor of sqrt(2).
1777+ number of incoherent averaging samples and comes from `self.nsample_array`.
1778+ If ` component` is ` real` or ` imag` , P_N is divided by an additional
1779+ factor of sqrt(2).
17821780
17831781 If the polarizations specified are pseudo Stokes pol (I, Q, U or V)
17841782 then an extra factor of 2 is divided.
1785- If form == 'DelSq' then a factor of |k|^3 / (2pi^2) is multiplied.
1783+
1784+ If `form` is `DelSq` then a factor of `|k|^3 / (2pi^2)` is multiplied.
1785+
17861786 If real is True, a factor of sqrt(2) is divided to account for
17871787 discarding imaginary noise component.
17881788
@@ -1822,8 +1822,9 @@ def generate_noise_spectra(self, spw, polpair, Tsys, blpairs=None,
18221822 Number of frequency bins to use in integrating power spectrum
18231823 scalar in pspecbeam. Default: 2000.
18241824
1825- component : str, options=['real', 'imag', 'abs']
1826- If component is real or imag, divide by an extra factor of sqrt(2)
1825+ component : str
1826+ Options=['real', 'imag', 'abs'].
1827+ If component is real or imag, divide by an extra factor of sqrt(2).
18271828
18281829 Returns
18291830 -------
@@ -1909,14 +1910,14 @@ def generate_noise_spectra(self, spw, polpair, Tsys, blpairs=None,
19091910
19101911 def average_spectra (self , blpair_groups = None , time_avg = False ,
19111912 blpair_weights = None , error_field = None , error_weights = None ,
1912- inplace = True ):
1913+ inplace = True , add_to_history = '' ):
19131914 """
19141915 Average power spectra across the baseline-pair-time axis, weighted by
19151916 each spectrum's integration time.
19161917
19171918 This is an "incoherent" average, in the sense that this averages power
1918- spectra, rather than visibility data. The ' nsample_array' and
1919- ' integration_array' will be updated to reflect the averaging.
1919+ spectra, rather than visibility data. The ` nsample_array` and
1920+ ` integration_array` will be updated to reflect the averaging.
19201921
19211922 In the case of averaging across baseline pairs, the resultant averaged
19221923 spectrum is assigned to the zeroth blpair in the group. In the case of
@@ -1929,14 +1930,15 @@ def average_spectra(self, blpair_groups=None, time_avg=False,
19291930 equivalent to cylindrical binning in 3D k-space.
19301931
19311932 If you want help constructing baseline-pair groups from baseline
1932- groups, see self.get_blpair_groups_from_bl_groups.
1933+ groups, see ` self.get_blpair_groups_from_bl_groups` .
19331934
19341935 Parameters
19351936 ----------
19361937 blpair_groups : list
19371938 List of list of baseline-pair group tuples or integers. All power
19381939 spectra in a baseline-pair group are averaged together. If a
19391940 baseline-pair exists in more than one group, a warning is raised.
1941+
19401942 Examples::
19411943
19421944 blpair_groups = [ [((1, 2), (1, 2)), ((2, 3), (2, 3))],
@@ -1951,6 +1953,7 @@ def average_spectra(self, blpair_groups=None, time_avg=False,
19511953 blpair_weights : list, optional
19521954 List of float or int weights dictating the relative weight of each
19531955 baseline-pair when performing the average.
1956+
19541957 This is useful for bootstrapping. This should have the same shape
19551958 as blpair_groups if specified. The weights are automatically
19561959 normalized within each baseline-pair group. Default: None (all
@@ -1965,17 +1968,21 @@ def average_spectra(self, blpair_groups=None, time_avg=False,
19651968
19661969 error_weights: string, optional
19671970 error_weights specify which kind of errors we use for weights
1968- during averaging power spectra.
1969- The weights are defined as $w_i = 1/ sigma_i^2$,
1970- where $sigma_i$ is taken from the relevant field of stats_array.
1971- If `error_weight' is set to None, which means we just use the
1972- integration time as weights. If error_weights is specified,
1973- then it also gets appended to error_field as a list.
1974- Default: None
1971+ during averaging power spectra. The weights are defined as
1972+ $w_i = 1/ sigma_i^2$, where $sigma_i$ is taken from the relevant
1973+ field of stats_array.
1974+
1975+ If `error_weight` is set to `None`, which means we just use the
1976+ integration time as weights. If `error_weights` is specified,
1977+ then it also gets appended to `error_field` as a list.
1978+ Default: None.
19751979
19761980 inplace : bool, optional
1977- If True, edit data in self, else make a copy and return. Default:
1978- True.
1981+ If True, edit data in self, else make a copy and return.
1982+ Default: True.
1983+
1984+ add_to_history : str, optional
1985+ Added text to add to file history.
19791986
19801987 Notes
19811988 -----
@@ -1991,14 +1998,14 @@ def average_spectra(self, blpair_groups=None, time_avg=False,
19911998 error_field = error_field ,
19921999 error_weights = error_weights ,
19932000 blpair_weights = blpair_weights ,
1994- inplace = True )
2001+ inplace = True , add_to_history = add_to_history )
19952002 else :
19962003 return grouping .average_spectra (self , blpair_groups = blpair_groups ,
19972004 time_avg = time_avg ,
19982005 error_field = error_field ,
19992006 error_weights = error_weights ,
20002007 blpair_weights = blpair_weights ,
2001- inplace = False )
2008+ inplace = False , add_to_history = add_to_history )
20022009
20032010 def fold_spectra (self ):
20042011 """
0 commit comments