Skip to content

Commit

Permalink
trivial tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
cmbant committed Feb 2, 2022
1 parent 11fdbbb commit 1124228
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion camb/baseconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def get_allocatable(self):
if size:
return ctypes.cast(_reuse_pointer, POINTER(self._ctype * size)).contents
else:
return np.asarray([])
return np.empty(0)

def set_allocatable(self, array, name):
self._set_allocatable_1D_array(byref(self), np.array(array, dtype=self._dtype),
Expand Down
2 changes: 1 addition & 1 deletion camb/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def set_initial_power_table(self, k, pk=None, pk_tensor=None, effective_ns_for_n
if effective_ns_for_nonlinear is not None:
initpower.effective_ns_for_nonlinear = effective_ns_for_nonlinear
if pk is None:
pk = np.asarray([])
pk = np.empty(0)
elif len(k) != len(pk):
raise CAMBValueError("k and P(k) arrays must be same size")
if pk_tensor is not None:
Expand Down
16 changes: 8 additions & 8 deletions camb/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class _ClTransferData(CAMB_Structure):

def save_cmb_power_array(filename, array, labels, lmin=0):
"""
Save an zero-based 2-d array of CL to a text file, with each line starting with L.
Save a zero-based 2-d array of CL to a text file, with each line starting with L.
:param filename: filename to save
:param array: 2D array of power spectra
Expand Down Expand Up @@ -303,8 +303,8 @@ def calc_transfers(self, params, only_transfers=True, only_time_sources=False):
:param params: :class:`~.model.CAMBparams` instance with parameters to use
:param only_transfers: only calculate transfer functions, no power spectra
:param only_time_sources: only calculate time transfer functions, no (p,l,k) transfer functions or non-
linear scaling
:param only_time_sources: only calculate time transfer functions, no (p,l,k) transfer functions or
non-linear scaling
:return: non-zero if error, zero if OK
"""
self._check_params(params)
Expand Down Expand Up @@ -737,7 +737,7 @@ def get_linear_matter_power_spectrum(self, var1=None, var2=None, hubble_units=Tr
:param params: if have_power_spectra=False, optional :class:`~.model.CAMBparams` instance
to specify new parameters
:param nonlinear: include non-linear correction from halo model
:return: k/h or k, z, PK, where kz an z are arrays of k/h or k and z respectively,
:return: k/h or k, z, PK, where kz and z are arrays of k/h or k and z respectively,
and PK[i,j] is the value at z[i], k[j]/h or k[j]
"""
if self.OnlyTransfers or params is not None or not have_power_spectra:
Expand Down Expand Up @@ -785,7 +785,7 @@ def get_nonlinear_matter_power_spectrum(self, var1=None, var2=None, hubble_units
:param have_power_spectra: set to False if not already computed power spectra
:param params: if have_power_spectra=False, optional :class:`~.model.CAMBparams` instance
to specify new parameters
:return: k/h or k, z, PK, where kz an z are arrays of k/h or k and z respectively,
:return: k/h or k, z, PK, where kz and z are arrays of k/h or k and z respectively,
and PK[i,j] is the value at z[i], k[j]/h or k[j]
"""
return self.get_linear_matter_power_spectrum(var1=var1, var2=var2, hubble_units=hubble_units, k_hunit=k_hunit,
Expand Down Expand Up @@ -890,7 +890,7 @@ def get_matter_power_spectrum(self, minkh=1e-4, maxkh=1.0, npoints=100,
:param have_power_spectra: set to True if already computed power spectra
:param params: if have_power_spectra=False and want to specify new parameters,
a :class:`~.model.CAMBparams` instance
:return: kh, z, PK, where kz an z are arrays of k/h and z respectively, and PK[i,j] is value at z[i], k/h[j]
:return: kh, z, PK, where kz and z are arrays of k/h and z respectively, and PK[i,j] is value at z[i], k/h[j]
"""

if not have_power_spectra:
Expand Down Expand Up @@ -1327,8 +1327,8 @@ def get_partially_lensed_cls(self, Alens, lmax=None, CMB_unit=None, raw_cl=False
true lensing spectrum scaled by Alens. Alens can be an array in L for realistic delensing estimates.
Note that if Params.Alens is also set, the result is scaled by the product of both
:param Alens: scaling of the lensing relative to true, with Alens=1 being the standard result. Can
can a scalar in which case all L are scaled, or an zero-based array with the L by L scaling
:param Alens: scaling of the lensing relative to true, with Alens=1 being the standard result.
Can be a scalar in which case all L are scaled, or a zero-based array with the L by L scaling
(with L larger than the size of the array having Alens_L=1).
:param lmax: lmax to output to
:param CMB_unit: scale results from dimensionless. Use 'muK' for :math:`\mu K^2` units for CMB :math:`C_\ell`
Expand Down

0 comments on commit 1124228

Please sign in to comment.