Skip to content

Commit

Permalink
Add the code spell pre-commit and fix all existing spelling errors
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoryAshton committed Jul 8, 2021
1 parent 17e6a80 commit 50f9b2b
Show file tree
Hide file tree
Showing 47 changed files with 73 additions and 71 deletions.
3 changes: 3 additions & 0 deletions .dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
hist
livetime
iff
amin
amax
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ repos:
hooks:
- id: codespell
args: [--ignore-words=.dictionary.txt]
files: ^bilby/bilby_mcmc/
- repo: https://github.com/asottile/seed-isort-config
rev: v1.3.0
hooks:
Expand Down
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Version 1.1.0 release of bilby
- Fixed `ultranest` from failing
- Fixed issues with plotting failing in tests (!904)
- Changed the CI to run on auto-built images (!899)
- Resolved a `matplotlib` error occuring at `dynesty` checkpoint plots (!902)
- Resolved a `matplotlib` error occurring at `dynesty` checkpoint plots (!902)
- Fixed the multidimensional Gaussian example (!901)
- Now allow any lal dictionary option and added a numerical relativity file (!896)
- Fixed the likelihood count in `dynesty` (!853)
Expand Down Expand Up @@ -171,7 +171,7 @@ Version 1.0.1 release of bilby
- Fixed a minor issue with conditional priors that could cause unexpected behaviour in edge cases (!838)
- Fixed `__repr__` method in the `FromFile` prior (!836)
- Fixed an issue that caused problems for some users when plotting with a latex backend (!816)
- Fixed bug that occured when min/max of interpolated priors was changed (!815)
- Fixed bug that occurred when min/max of interpolated priors was changed (!815)
- Fixed time domain waveform epoch (!736)
- Fixed time keeping in multinest (!830)
- Now checks if marginalised priors were defined before marginalising (!829)
Expand Down Expand Up @@ -209,7 +209,7 @@ for details
- Updated the default PSD to O4 (!757)
- Make multinest allow long file names, optional and work with MPI (!764 !785)
- Add min/max to aligned spin prior (!787)
- Reduce redudant code (!703)
- Reduce redundant code (!703)
- Added testing for python 3.8 (!762)
- Improvements to the waveform plot (!769)

Expand Down Expand Up @@ -310,7 +310,7 @@ parameters.

## Changes
- Speed up the prior evaluations by implementing directly with checks to scipy !627
- Soft initalisation option for the Sampler class !620
- Soft initialisation option for the Sampler class !620
- Improvements to JSON reading and writing for functions !621
- Fixed bug in prior reading !618 !617
- Fixes to the examples !619 !614 !626 !616
Expand Down Expand Up @@ -371,7 +371,7 @@ parameters.
- Removed the sqrt(2) normalisation from the scalar longitudinal mode
- Improve PSD filename reading (no longer required "/" to read local files)
- Fix bug in emcee chains
- Added a try/except cluase for building the lookup table
- Added a try/except clause for building the lookup table

## [0.5.4] 2019-07-30

Expand Down Expand Up @@ -412,7 +412,7 @@ shown (!564) to provide better convergence for the long-duration high-spin tests

### Changed
- Updated and fixed bugs in examples
- Resolve sampling time persistence for runs which are interupted
- Resolve sampling time persistence for runs which are interrupted
- Improvements to the PP plot
- Speed up of the distance calculation
- Fixed a bug in the inteference of bilby command line arguments with user specified command lines
Expand Down Expand Up @@ -708,7 +708,7 @@ re-instantiate the Prior in most cases
- Changed to using `setuptools` for installation.
- Clean up of real data handling: all data is now windowed with a 0.4s roll off (unless set otherwise) and low-pass filtered.
- Add explicit method to create a power spectral density from time-domain data
- Clean up of `PowerSpectralDensity()` - addds `set_from` methods to handle various ways to define the PSD.
- Clean up of `PowerSpectralDensity()` - adds `set_from` methods to handle various ways to define the PSD.
- Clean up of `detectors.py`: adds an `InterferometerStrainData` to handle strain data and `InterferometerSet` to handle multiple interferometers. All data setting should primarily be done through the `Interferometer.set_strain_data..` methods.
- Fix the comments and units of `nfft` and `infft` and general improvement to documentation of data.
- Fixed a bug in create_time_series
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ help orient users and make it easier to contribute. The layout is intended to
define the logic of the code and new merge requests should aim to fit within
this logic (unless there is a good argument to change it). For example, code
which adds a new sampler should not effect the gravitational-wave specific
parts of the code. Note that this document is not programatically generated and
parts of the code. Note that this document is not programmatically generated and
so may get out of date with time. If you notice something wrong, please open an
issue.

Expand Down
2 changes: 1 addition & 1 deletion bilby/core/prior/analytical.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class SymmetricLogUniform(Prior):

def __init__(self, minimum, maximum, name=None, latex_label=None,
unit=None, boundary=None):
"""Symmetric Log-Uniform distribtions with bounds
"""Symmetric Log-Uniform distributions with bounds
This is identical to a Log-Uniform distribution, but mirrored about
the zero-axis and subsequently normalized. As such, the distribution
Expand Down
2 changes: 1 addition & 1 deletion bilby/core/prior/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def _parse_argument_string(cls, val):
Parameters
==========
val: str
The string version of the agument
The string version of the argument
Returns
=======
Expand Down
14 changes: 7 additions & 7 deletions bilby/core/prior/joint.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class BaseJointPriorDist(object):
def __init__(self, names, bounds=None):
"""
A class defining JointPriorDist that will be overwritten with child
classes defining the joint prior distribtuions between given parameters,
classes defining the joint prior distributions between given parameters,
Parameters
Expand Down Expand Up @@ -210,7 +210,7 @@ def _ln_prob(self, samp, lnprob, outbounds):
samp: vector
sample to evaluate the ln_prob at
lnprob: vector
of -inf pased in with the same shape as the number of samples
of -inf passed in with the same shape as the number of samples
outbounds: array_like
boolean array showing which samples in lnprob vector are out of the given bounds
Expand All @@ -231,7 +231,7 @@ def sample(self, size=1, **kwargs):
Parameters
==========
size: int
number of samples to generate, defualts to 1
number of samples to generate, defaults to 1
"""

if size is None:
Expand All @@ -250,7 +250,7 @@ def _sample(self, size, **kwargs):
Parameters
==========
size: int
number of samples to generate, defualts to 1
number of samples to generate, defaults to 1
"""
samps = np.zeros((size, len(self)))
"""
Expand Down Expand Up @@ -299,7 +299,7 @@ def _rescale(self, samp, **kwargs):
Parameters
==========
samp: numpy array
this is a vector sample drawn from a uniform distribtuion to be rescaled to the distribution
this is a vector sample drawn from a uniform distribution to be rescaled to the distribution
"""
"""
Here is where the subclass where overwrite rescale method
Expand Down Expand Up @@ -707,7 +707,7 @@ def rescale(self, val, **kwargs):
Returns
=======
float:
A sample from the prior paramter.
A sample from the prior parameter.
"""

self.dist.rescale_parameters[self.name] = val
Expand All @@ -733,7 +733,7 @@ def sample(self, size=1, **kwargs):
Returns
=======
float:
A sample from the prior paramter.
A sample from the prior parameter.
"""

if self.name in self.dist.sampled_parameters:
Expand Down
10 changes: 5 additions & 5 deletions bilby/core/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ def save_to_file(self, filename=None, overwrite=False, outdir=None,
def save_posterior_samples(self, filename=None, outdir=None, label=None):
""" Saves posterior samples to a file
Generates a .dat file containing the posterior samples and auxillary
Generates a .dat file containing the posterior samples and auxiliary
data saved in the posterior. Note, strings in the posterior are
removed while complex numbers will be given as absolute values with
abs appended to the column name
Expand Down Expand Up @@ -1724,7 +1724,7 @@ class ResultList(list):
def __init__(self, results=None):
""" A class to store a list of :class:`bilby.core.result.Result` objects
from equivalent runs on the same data. This provides methods for
outputing combined results.
outputting combined results.
Parameters
==========
Expand Down Expand Up @@ -1820,7 +1820,7 @@ def _combine_nested_sampled_runs(self, result):
result.log_evidence = logsumexp(log_evidences, b=1. / len(self))
result.log_bayes_factor = result.log_evidence - result.log_noise_evidence

# Propogate uncertainty in combined evidence
# Propagate uncertainty in combined evidence
log_errs = [res.log_evidence_err for res in self if np.isfinite(res.log_evidence_err)]
if len(log_errs) > 0:
result.log_evidence_err = 0.5 * logsumexp(2 * np.array(log_errs), b=1. / len(self))
Expand Down Expand Up @@ -1866,7 +1866,7 @@ def _combine_mcmc_sampled_runs(self, result):
result.log_evidence = logsumexp(log_evidences, b=1. / len(self))
result.log_bayes_factor = result.log_evidence - result.log_noise_evidence

# Propogate uncertainty in combined evidence
# Propagate uncertainty in combined evidence
log_errs = [res.log_evidence_err for res in self if np.isfinite(res.log_evidence_err)]
if len(log_errs) > 0:
result.log_evidence_err = 0.5 * logsumexp(2 * np.array(log_errs), b=1. / len(self))
Expand Down Expand Up @@ -2136,7 +2136,7 @@ class ResultError(Exception):


class ResultListError(ResultError):
""" For Errors occuring during combining results. """
""" For Errors occurring during combining results. """


class FileMovedError(ResultError):
Expand Down
2 changes: 1 addition & 1 deletion bilby/core/sampler/dynesty.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ def sample_rwalk_bilby(args):
def estimate_nmcmc(accept_ratio, old_act, maxmcmc, safety=5, tau=None):
""" Estimate autocorrelation length of chain using acceptance fraction
Using ACL = (2/acc) - 1 multiplied by a safety margin. Code adapated from CPNest:
Using ACL = (2/acc) - 1 multiplied by a safety margin. Code adapted from CPNest:
- https://github.com/johnveitch/cpnest/blob/master/cpnest/sampler.py
- http://github.com/farr/Ensemble.jl
Expand Down
4 changes: 2 additions & 2 deletions bilby/core/sampler/emcee.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def checkpoint(self):
dill.dump(self._sampler, f)

def checkpoint_and_exit(self, signum, frame):
logger.info("Recieved signal {}".format(signum))
logger.info("Received signal {}".format(signum))
self.checkpoint()
sys.exit()

Expand All @@ -275,7 +275,7 @@ def _initialise_sampler(self):
def sampler(self):
""" Returns the ptemcee sampler object
If, alrady initialized, returns the stored _sampler value. Otherwise,
If, already initialized, returns the stored _sampler value. Otherwise,
first checks if there is a pickle file from which to load. If there is
not, then initialize the sampler and set the initial random draw
Expand Down
2 changes: 1 addition & 1 deletion bilby/core/sampler/nessai.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class Nessai(NestedSampler):
"""bilby wrapper of nessai (https://github.com/mj-will/nessai)
All positional and keyword arguments passed to `run_sampler` are propogated
All positional and keyword arguments passed to `run_sampler` are propagated
to `nessai.flowsampler.FlowSampler`
See the documentation for an explanation of the different kwargs.
Expand Down
4 changes: 2 additions & 2 deletions bilby/core/sampler/ptemcee.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Ptemcee(MCMCSampler):
The number of iteration steps to take before checking ACT. This
effectively pre-thins the chains. Larger values reduce the per-eval
timing due to improved efficiency. But, if it is made too large the
pre-thinning may be overly agressive effectively wasting compute-time.
pre-thinning may be overly aggressive effectively wasting compute-time.
If you see tau=1, then niterations_per_check is likely too large.
Expand Down Expand Up @@ -720,7 +720,7 @@ def check_iteration(
Returns
=======
stop: bool
A boolean flag, True if the stoping criteria has been met
A boolean flag, True if the stopping criteria has been met
burn: int
The number of burn-in steps to discard
thin: int
Expand Down
2 changes: 1 addition & 1 deletion bilby/core/utils/calculus.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def derivatives(vals, func, releps=1e-3, abseps=None, mineps=1e-9, reltol=1e-3,
raise ValueError("To many non-fixed values")

if max(nonfixedidx) >= len(vals) or min(nonfixedidx) < 0:
raise ValueError("Non-fixed indexes contain non-existant indices")
raise ValueError("Non-fixed indexes contain non-existent indices")

grads = np.zeros(len(nonfixedidx))

Expand Down
2 changes: 1 addition & 1 deletion bilby/core/utils/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def set_up_command_line_arguments():
.. code-block:: python
# Here we import bilby, which initialses and parses the default command-line args
# Here we import bilby, which initialises and parses the default command-line args
>>> import bilby
# The command line arguments can then be accessed via
>>> bilby.core.utils.command_line_args
Expand Down
4 changes: 2 additions & 2 deletions bilby/core/utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def decode_from_hdf5(item):

def encode_for_hdf5(item):
"""
Encode an item to a HDF5 savable format.
Encode an item to a HDF5 saveable format.
.. versionadded:: 1.1.0
Expand All @@ -222,7 +222,7 @@ def encode_for_hdf5(item):
Returns
-------
output: object
Input item converted into HDF5 savable format
Input item converted into HDF5 saveable format
"""
from ..prior.dict import PriorDict
if isinstance(item, np.int_):
Expand Down
2 changes: 1 addition & 1 deletion bilby/gw/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def chirp_mass_and_primary_mass_to_mass_ratio(chirp_mass, mass_1):
(chirp_mass/mass_1)^5 = q^3 / (1 + q)
Solving for q, we find the releation expressed in python below for q.
Solving for q, we find the relation expressed in python below for q.
Parameters
==========
Expand Down
2 changes: 1 addition & 1 deletion bilby/gw/detector/interferometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def inject_signal_from_waveform_polarizations(self, parameters, injection_polari

@property
def amplitude_spectral_density_array(self):
""" Returns the amplitude spectral density (ASD) given we know a power spectral denstiy (PSD)
""" Returns the amplitude spectral density (ASD) given we know a power spectral density (PSD)
Returns
=======
Expand Down
2 changes: 1 addition & 1 deletion bilby/gw/eos/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ def __init__(self, eos, npts=500):
# If we're not at the end of the array, determine actual maximum mass. Else, assume
# last point is the maximum mass and proceed.
if i < (npts - 1):
# Now replace ith point with interpolated maximum mass
# Now replace with point with interpolated maximum mass
# This is done by interpolating the last three points and then
# minimizing the negative of the interpolated function
x = [energy_density_grid[i - 2], energy_density_grid[i - 1], energy_density_grid[i]]
Expand Down
4 changes: 2 additions & 2 deletions bilby/gw/likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def generate_time_sample_from_marginalized_likelihood(
Generate a single sample from the posterior distribution for coalescence
time when using a likelihood which explicitly marginalises over time.
In order to resolve the posterior we artifically upsample to 16kHz.
In order to resolve the posterior we artificially upsample to 16kHz.
See Eq. (C29-C32) of https://arxiv.org/abs/1809.02293
Expand Down Expand Up @@ -1605,7 +1605,7 @@ def load_weights(filename, format=None):
if format is None:
format = filename.split(".")[-1]
if format not in ["json", "npz"]:
raise IOError("Format {} not recongized.".format(format))
raise IOError("Format {} not recognized.".format(format))
logger.info("Loading ROQ weights from {}".format(filename))
if format == "json":
with open(filename, 'r') as file:
Expand Down
6 changes: 3 additions & 3 deletions bilby/gw/prior.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ def from_envelope_file(envelope_file, minimum_frequency,
Number of nodes for the spline.
label: str
Label for the names of the parameters, e.g., `recalib_H1_`
bounadry: None, 'reflective', 'periodic'
boundary: None, 'reflective', 'periodic'
The type of prior boundary to assign
Returns
Expand Down Expand Up @@ -1114,7 +1114,7 @@ class HealPixMapPriorDist(BaseJointPriorDist):
==========
hp_file : file path to .fits file
.fits file that containes the 2D or 3D Healpix Map
.fits file that contains the 2D or 3D Healpix Map
names : list (optional)
list of names of parameters included in the JointPriorDist, defaults to ['ra', 'dec']
bounds : dict or list (optional)
Expand Down Expand Up @@ -1238,7 +1238,7 @@ def update_distance(self, pix_idx):
Parameters
==========
pix_idx : int
pixel index value to create the distribtuion for
pixel index value to create the distribution for
Returns
=======
Expand Down
2 changes: 1 addition & 1 deletion bilby/gw/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def lal_binary_neutron_star(
only take positive modes and return the positive and the negative
mode together, while others need to call both. e.g.
waveform_arguments = dict(waveform_approximant='IMRPhenomHM',
mode_array=[[2,2],[4,-4]]) returns the 22 a\nd 2-2 of IMRPhenomHM.
mode_array=[[2,2],[4,-4]]) returns the 22 and 2-2 of IMRPhenomHM.
However, waveform_arguments =
dict(waveform_approximant='IMRPhenomXHM', mode_array=[[2,2],[4,-4]])
returns the 22 and 4-4 of IMRPhenomXHM.
Expand Down
Loading

0 comments on commit 50f9b2b

Please sign in to comment.