Skip to content

Commit

Permalink
Style and grammar.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheChymera committed Sep 3, 2017
1 parent 432986e commit d68af52
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cosgen/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def cli_algorithm(population_size=20, library_size=20, storage_path='~/.cosgen',
"""
Run default optimization.
This function attempts to optimize find a good sequence with only few input parameters.
This function attempts to optimize towards a viable sequence, while only requiring few input parameters.
It uses a generic design matrix construction and a first order autoregressive model.
Parameters
Expand Down
2 changes: 1 addition & 1 deletion cosgen/cross_over.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def cross_over(sequence1, sequence2):
"""
Create offspring of sequence1 and sequence2.
This function creats an offspring of sequence1 and sequence2 by
This function creates an offspring of sequence1 and sequence2 by
cutting them at a random point and merging the two ends.
Parameters
Expand Down
18 changes: 9 additions & 9 deletions cosgen/function_crate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ class MissingAttrError(Exception):
pass

class WrongOrderError(Exception):
"""This error is raised if the functions are added to a
"""This error is raised if functions are added to a
FunctionCrate object in the wrong order."""
pass

class RmAttrError(Exception):
"""This error is raised if an attribut of a FunctionCrate object
"""This error is raised if an attribute of a FunctionCrate object
can not be removed because it does not exist."""
pass

class OverwriteAttrError(Exception):
"""This error is raised if an attribut of a FunctionCrate object
"""This error is raised if an attribute of a FunctionCrate object
already exist."""
pass

Expand All @@ -36,7 +36,7 @@ def partition(population, left, right, pivotIndex):
return storeIndex

def quickselect(population, left, right, k):
"""Returns the k-th smallest, (k >= 0), element of population within population[left:right+1] inclusive.
"""Returns the k-th smallest, (k >= 0), element of `population` within `population[left:right+1]` inclusive.
Implementation of the quickselect algorithm from https://rosettacode.org/wiki/Quickselect_algorithm#Python."""
while True:
pivotIndex = random.randint(left, right) # select pivotIndex between left and right
Expand Down Expand Up @@ -85,7 +85,7 @@ def find_best(population, n):
"""
Find n best sequences in population.
This method finds the n sequences with the highest fitness in population.
This method finds the n sequences with the highest fitness in the population.
Parameters
----------
Expand All @@ -107,7 +107,7 @@ def add_fitness_measure(self, name, function):
Add fitness measure function to object.
This method adds a fitness measure function to the
object, that is used in the evaluate fitness method. The
object, that is used in the `evaluate_fitness` method. The
function must take a sequences as parameter and retrun a
float.
Expand Down Expand Up @@ -144,7 +144,7 @@ def set_mutate(self, function):
"""
Set a mutate function.
This methode sets a mutate function used by the genetic
This method sets a mutate function used by the genetic
algorithm. The function should normally take a
cosgen.sequence.Sequence object as input and return a
cosgen.sequence.Sequence object.
Expand Down Expand Up @@ -173,7 +173,7 @@ def set_cross_over(self, function):
"""
Set a cross over function.
This methode sets a cross over function used by the
This method sets a cross over function used by the
genetic algorithm. The function should normally take two
cosgen.sequence.Sequence objects as input and return a
cosgen.sequence.Sequence object.
Expand Down Expand Up @@ -202,7 +202,7 @@ def set_generate_immigrants(self,function):
"""
Set a generate immigrants function.
This methode sets a generate immigrants function used by
This method sets a generate immigrants function used by
the genetic algorithm. The function should normally return
a list of cosgen.sequence.Sequence objects. If the
function as an argument 'cross_over_fct' a cross over
Expand Down
12 changes: 6 additions & 6 deletions cosgen/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def cov_beta(self, X):

class EstimationModel(Model):
"""
This class implements a model for estimating the hrf.
This class implements a model for estimating the Haemodynamic Response Function (HRF).
The model employes pre-whitening to account for
autocorrelation for the errors. Either 'whitening_mat or
Expand Down Expand Up @@ -191,7 +191,7 @@ def cov_beta(self, X):
class DetectionModel(Model):
"""
This class implements a model for detecting specific
constrasts for a given/known hrf.
constrasts for a given/known Haemodynamic Response Function (HRF).
Unless otherwise specified the parameters and returns are the same
as for EstimationModel.
Expand Down Expand Up @@ -228,8 +228,8 @@ def design_matrix(self, sequence):
This method calculates the desing matrix for a given
sequence. Colums of the desing matrix are a constant
(ones) a linear time course and the convolution of the
hrf with the sequence.
(ones) a linear time course and the convolution of `hrf`
with the sequence.
Parameters
----------
Expand Down Expand Up @@ -321,9 +321,9 @@ def get_FIR_basis_set(length):

def get_gamma_hrf(TR, length, a1=6, a2=16, a3=1, a4=1, a5=1, a6=0):
"""
Return hrf that is difference of two gamma function.
Return Haemodynamic Response Function (HRF) that is difference of two gamma function.
This function returns an hrf array constructed using the following
This function returns an HRF array constructed using the following
formula\:
.. math:: h(t) = \\frac{(t-a_6)^{a_1/a_3-1}\\exp(-(t-a_6)/a_3)}{\\Gamma (a_1/a_3)a_3^{a_1/a_3}} - a_5\\frac{(t-a_6)^{a_2/a_4-1}\\exp(-(t-a_6)/a_4)}{\\Gamma (a_2/a_4)a_4^{a_2/a_4}}
Expand Down

0 comments on commit d68af52

Please sign in to comment.