Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add codespell support (config, workflow to detect/not fix) and make it fix few typos #208

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = .git*,*.pdf,*.svg,*.css,.codespellrc
check-hidden = true
ignore-regex = ^\s*"image/\S+": ".*|\b[a-z]*[A-Z][a-zA-Z]*\b
ignore-words-list = childrens,childs
25 changes: 25 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Codespell configuration is within .codespellrc
---
name: Codespell

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Annotate locations with typos
uses: codespell-project/codespell-problem-matcher@v1
- name: Codespell
uses: codespell-project/actions-codespell@v2
18 changes: 9 additions & 9 deletions scripts/lems/sourceannotations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The value of a constant must be a plain number (no units) giving the SI magnitud
<Property name="dimension" type="String"/>
</ElementType>
<ElementType name="Dimension" section="unitsdimensions">
<Info>A Dimenson element associated a name with a particular combination of the standards SI base dimensions, mass, lenght, time, current, temperature and amount if substance (moles). Fractional dimensions are not currently supported.</Info>
<Info>A Dimenson element associated a name with a particular combination of the standards SI base dimensions, mass, length, time, current, temperature and amount if substance (moles). Fractional dimensions are not currently supported.</Info>
<Property name="name" type="String">
The name to be used when referring to this dimension from variable declaration or units </Property>
<Property name="m" type="int">
Expand All @@ -48,7 +48,7 @@ Amount of substance </Property>
Luminous intensity </Property>
</ElementType>
<ElementType name="Unit" section="unitsdimensions">
<Info>A Unit asociates a symbol with a dimension and a power of ten. For non-metric units a scale can be provided, as in '1 inch = 0.0254 m'. In this case there is a degeneracy between the power and the scale which is best resolved by not using the two together. The offset parameter is available for units which are not zero-offset, such as farenheit.</Info>
<Info>A Unit associates a symbol with a dimension and a power of ten. For non-metric units a scale can be provided, as in '1 inch = 0.0254 m'. In this case there is a degeneracy between the power and the scale which is best resolved by not using the two together. The offset parameter is available for units which are not zero-offset, such as fahrenheit.</Info>
<Property name="name" type="String">
As with constants, units are only referred to within expressions using their symbols, so the name is just for readability. </Property>
<Property name="symbol" type="String">
Expand Down Expand Up @@ -89,13 +89,13 @@ The component type that this type inherits field definitions for, if any
<ListProperty name="componentReferences" type="ComponentReference"/>
<ListProperty name="componentTypeReferences" type="ComponentTypeReference"/>
<ListProperty name="locations" type="Location"/>
<ListProperty name="propertys" type="Property"/>
<ListProperty name="properties" type="Property"/>
<ListProperty name="dynamicses" type="Dynamics"/>
<ListProperty name="structures" type="Structure"/>
<ListProperty name="simulations" type="Simulation"/>
<ListProperty name="equilibriums" type="Equilibrium"/>
<ListProperty name="procedures" type="Procedure"/>
<ListProperty name="geometrys" type="Geometry"/>
<ListProperty name="geometries" type="Geometry"/>
<ListProperty name="fixeds" type="Fixed"/>
<ListProperty name="constants" type="Constant"/>
<ListProperty name="attachmentses" type="Attachments"/>
Expand All @@ -117,7 +117,7 @@ The dimension, or 'none'. This should be the name of an already defined dimensio
An optional description of the parameter </Property>
</ElementType>
<ElementType name="PathParameter" section="componenttypes">
<Info>A parameter of which the value is a path expression. When a ComponentType declares a PathParameter, a corresponding Component definition should have an attibute with that name whose value is a path expression that evaluates within the instance tree of the built model. This is used, for example, in the definition of a group component class, where the coresponding component specifies a path over the instance tree which selectesthe items that should go in the group.</Info>
<Info>A parameter of which the value is a path expression. When a ComponentType declares a PathParameter, a corresponding Component definition should have an attribute with that name whose value is a path expression that evaluates within the instance tree of the built model. This is used, for example, in the definition of a group component class, where the corresponding component specifies a path over the instance tree which selectesthe items that should go in the group.</Info>
<Property name="name" type="String">
Name of the parameter </Property>
</ElementType>
Expand Down Expand Up @@ -213,7 +213,7 @@ An optional description of the ComponentReference </Property>
<Property name="name" type="String"/>
</ElementType>
<ElementType name="Collection" section="componenttypes">
<Info>Specifies that instances of components based on this class can containe a named collection of other instances. This provides for containers for oprating on groups of instances with path and filter expressions defined in components to operate over the instance tree.</Info>
<Info>Specifies that instances of components based on this class can contain a named collection of other instances. This provides for containers for operating on groups of instances with path and filter expressions defined in components to operate over the instance tree.</Info>
<Property name="name" type="String"/>
</ElementType>
<ElementType name="PairCollection" section="componenttypes">
Expand Down Expand Up @@ -241,7 +241,7 @@ An optional description of the element </Property>
<Property name="name" type="String"/>
</ElementType>
<ElementType name="Attachments" section="componenttypes">
<Info>Specifies that a component can accept attached components of a particular class. Attached components can be added at build time dependent on other events. For scoping and access purposes they are like child components. The cannonical use of attachments is in adding synapses to a cell when a network connection is made.</Info>
<Info>Specifies that a component can accept attached components of a particular class. Attached components can be added at build time dependent on other events. For scoping and access purposes they are like child components. The canonical use of attachments is in adding synapses to a cell when a network connection is made.</Info>
<Property name="name" type="String">
A name for the Attachments </Property>
<Property name="type" type="String">
Expand Down Expand Up @@ -319,7 +319,7 @@ The dimension, or 'none'. This should be the name of an already defined dimensio
<Property name="description" type="String">
An optional description of the derived variable </Property>
<Property name="reduce" type="String">
Either 'add' or 'multiply'. This applies if ther are multiple matches to the path or if 'required' is false. In the latter case, for multiply mode, multiplicative expressions in this variable behave as if the term was absent. Additive expressions generate an error. Conversely, if set to 'add' then additive expressions behave as if it was not there and multiplicative ones generateand error. </Property>
Either 'add' or 'multiply'. This applies if there are multiple matches to the path or if 'required' is false. In the latter case, for multiply mode, multiplicative expressions in this variable behave as if the term was absent. Additive expressions generate an error. Conversely, if set to 'add' then additive expressions behave as if it was not there and multiplicative ones generateand error. </Property>
<Property name="exposure" type="String"/>
<Property name="required" type="boolean">
Set to true if it OK for this variable to be absent. See 'reduce' for what happens in this case </Property>
Expand Down Expand Up @@ -358,7 +358,7 @@ Name of state variable in state elements </Property>
<Property name="edgeSource" type="String">
The name of the attribute in the rate element that defines the source of the transition </Property>
<Property name="edgeTarget" type="String">
Attribute tha defines the target </Property>
Attribute that defines the target </Property>
<Property name="forwardRate" type="String">
Name of forward rate exposure </Property>
<Property name="reverseRate" type="String">
Expand Down
2 changes: 1 addition & 1 deletion scripts/lems/xml2md.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
def get_lems_examples(srcdirs, examples_max=5):
"""Get examples for component types

:param srcdirs: directores where examples are
:param srcdirs: directories where examples are
:type srcdir: list(str)
:param examples_max: maximum number of examples to store
:type examples_max: int
Expand Down
6 changes: 3 additions & 3 deletions scripts/schemas/asttemplates.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def get_lems_type(variable):


def format_math(expr):
"""Replace math symbols with HTML conterparts
"""Replace math symbols with HTML counterparts

:param expr: expression to format
:type expr: str
Expand Down Expand Up @@ -387,12 +387,12 @@ def format_math(expr):
dynamics = env.from_string(textwrap.dedent(
"""
````{tab-item} {{ title }}
{% if comp_type.structure and (comp_type.structure.withs|length +
{% if comp_type.structure and (comp_type.structure.widths|length +
comp_type.structure.child_instances|length +
comp_type.structure.multi_instantiates|length +
comp_type.structure.event_connections|length) > 0 %}
<i>**Structure**</i>
{%- for w in comp_type.structure.withs %}
{%- for w in comp_type.structure.widths %}
: WITH **{{ w.instance }}** AS **{{ w.as_ }}**
{%- endfor -%}
{% for ci in comp_type.structure.child_instances %}
Expand Down
4 changes: 2 additions & 2 deletions scripts/schemas/generate-jupyter-ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def get_libneuroml_signatures():
def get_comp_examples(srcdirs, examples_max=3):
"""Get examples for component types

:param srcdirs: directores where examples are
:param srcdirs: directories where examples are
:type srcdir: list(str)
:param examples_max: maximum number of examples to store
:type examples_max: int
Expand Down Expand Up @@ -474,7 +474,7 @@ def main(srcdir, destdir):
units = model.units
units = sorted(units, key=lambda unit: unit.symbol)

# lables are translated as lowercase in jupyter, so we append two
# labels are translated as lowercase in jupyter, so we append two
# consecutive underscores to differentiate same ones, like M and m.
symbols = []
for unit in units:
Expand Down
10 changes: 5 additions & 5 deletions source/Events/2012-Edinburgh.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Chair: Andrew Davison
* - 11:30
- **Collaborative Modelling Repository update**

Padraig presented the initial work towards an open source, collaborative repository for NeuroML models, the Open Source Brain project. A preliminary version of this is avaliable here. It will be based on a version control repository (initially Mercurial) storing the model files. It will have automatic generation of online documentation of the models from ChannelML, MorphML, etc. Connectivity matrices for network connections, etc. can be generated for models which are stored in neuroConstruct format. NeuroLex IDs can be used to identify cells and channels to other resources. Feedback on the initial implementation was welcomed.
Padraig presented the initial work towards an open source, collaborative repository for NeuroML models, the Open Source Brain project. A preliminary version of this is available here. It will be based on a version control repository (initially Mercurial) storing the model files. It will have automatic generation of online documentation of the models from ChannelML, MorphML, etc. Connectivity matrices for network connections, etc. can be generated for models which are stored in neuroConstruct format. NeuroLex IDs can be used to identify cells and channels to other resources. Feedback on the initial implementation was welcomed.

- Padraig Gleeson

Expand Down Expand Up @@ -148,7 +148,7 @@ Chair: Sharon Crook
-

* - 17:30
- **Reconvene and presentated discussions**
- **Reconvene and presented discussions**
-

* - 18:00
Expand Down Expand Up @@ -207,7 +207,7 @@ Chair: Michael Hines
* - 11:00
- **The OpenWorm project: Using NeuroML in a highly detailed model of C. elegans ([PPT](https://docs.neuroml.org/_static/NeuroML2012/Open_Worm_03-13-12.ppt))**

Stephen presented the OpenWorm project. This ambitious project aims to build an in silico model of C. elegans. This well studied system with ~1000 cells and 302 identified neurons is an ideal system with which to attempt a full simulation of a living organism down to cellular scale. Many different approaches are being take in the project at the moment, including investigatin Smoothed Particle Hydrodynamics (SHP) to allow simulation of the interaction of the worm with its environment, and creating a new parallel (GPU based) simulator in Java which will support physical and electrical simulations. Full reconstructions of all of the cells are available in 3D and those of the neurons have been converted to NeuroML, which will form the basis of a simulation of the worm's nervous system.
Stephen presented the OpenWorm project. This ambitious project aims to build an in silico model of C. elegans. This well studied system with ~1000 cells and 302 identified neurons is an ideal system with which to attempt a full simulation of a living organism down to cellular scale. Many different approaches are being take in the project at the moment, including investigating Smoothed Particle Hydrodynamics (SHP) to allow simulation of the interaction of the worm with its environment, and creating a new parallel (GPU based) simulator in Java which will support physical and electrical simulations. Full reconstructions of all of the cells are available in 3D and those of the neurons have been converted to NeuroML, which will form the basis of a simulation of the worm's nervous system.

One of the concrete outcomes of code sprinting work on the fringes of the NeuroML/CodeJam meeting was the updated OpenWorm Browser, where the full cellular structure of the worm can be browsed in 3D.

Expand Down Expand Up @@ -263,7 +263,7 @@ Chair: Avrama Blackwell

Sarah gave a brief overview of libSBML and SBML Level 3. libSBML, which provides an API for creating, editing and saving SBML in many languages (e.g. C++, Python, Java, Ruby, Perl) has been instrumental in the growth of the number of applications supporting SBML.

SBML Level 3 has a modular architecture, featuring a core specification (roughly in line with previous SBML releases) and a number of specialist packages, which applications can choose to support or not. Examples of these packages incluse layout for storing the spatial topology of a model's network diagram, comp for defining how a model is composed from other models and spatial for describing models that involve a spatial component. libSBML already has a generic framework to support extensions for generic packages.
SBML Level 3 has a modular architecture, featuring a core specification (roughly in line with previous SBML releases) and a number of specialist packages, which applications can choose to support or not. Examples of these packages include layout for storing the spatial topology of a model's network diagram, comp for defining how a model is composed from other models and spatial for describing models that involve a spatial component. libSBML already has a generic framework to support extensions for generic packages.

- Sarah Keating

Expand All @@ -281,7 +281,7 @@ Chair: Avrama Blackwell
-

* - 17:30
- **Reconvene and presentated discussions**
- **Reconvene and presented discussions**
-

* - 18:00
Expand Down
4 changes: 2 additions & 2 deletions source/Userdocs/ConvertingModels.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Create a script to load the output of mod analysis and nml analysis and compare
(userdocs:creating_models:converting_conductance:compare_single_comp)=
### 4c) Compare single compartment cell with channels

Ensure you have a passive soma example in NeuroML which reproduces the behaviour of an equivalent passibe version inthe original format (from steps 3a and 4a above).
Ensure you have a passive soma example in NeuroML which reproduces the behaviour of an equivalent passibe version in the original format (from steps 3a and 4a above).

Gradually test the cell with passive conductance and *each channel individually*. Plot v along with rate variables for each channel & compare how they look during current pulse ([example in NEURON](https://github.com/OpenSourceBrain/BlueBrainProjectShowcase/blob/master/NMC/NEURON/Test_Soma.hoc) vs [example in NeuroML](https://github.com/OpenSourceBrain/BlueBrainProjectShowcase/blob/master/NMC/NeuroML2/Soma_AllNML2.cell.nml) and [LEMS](https://github.com/OpenSourceBrain/BlueBrainProjectShowcase/blob/master/NMC/NeuroML2/LEMS_Soma_AllNML2.xml))

Expand All @@ -138,7 +138,7 @@ export_to_neuroml2("test.hoc", "test.morphonly.cell.nml", includeBiophysicalProp

Alternatively manually add the `<channelDensity>` elements to the cell file (as [here](https://github.com/OpenSourceBrain/SmithEtAl2013-L23DendriticSpikes/blob/master/NeuroML2/L23_NoHotSpot.cell.nml#L16711)).

You can use the tools for {ref}`visualising NeuroML Models <userdocs:visualising_models>` to compare how these versions look agains the originals.
You can use the tools for {ref}`visualising NeuroML Models <userdocs:visualising_models>` to compare how these versions look against the originals.

As with the single compartment example, it's best to **start off with the passive case**, i.e no active channels on the soma or dendrites, and compare that to the original code (for membrane potential at multiple locations!), and gradually add channels.

Expand Down
2 changes: 1 addition & 1 deletion source/Userdocs/ExtendingNeuroMLv2.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ They define the membership structure of the type, but they do not specify values
Once a ComponentType has been defined, an instance of it can be created by setting values for its members.
This object is referred to as a **Component** in LEMS.

Having definitions in LEMS allows their re-use, and all new ComponentTypes can be submitted for inclusion to the NeuroMLv2 specification to be made accessible to other users.
Having definitions in LEMS allows their reuse, and all new ComponentTypes can be submitted for inclusion to the NeuroMLv2 specification to be made accessible to other users.

- Like NeuroML, LEMS also has a [well defined schema](https://github.com/LEMS/LEMS/tree/master/Schemas/LEMS) (XSD) that is used to validate LEMS XML files.
- Also similar to NeuroML, you can use the {ref}`LEMS Python tools <pylems>` to work with LEMS and do not need to work directly with the XML files.
Expand Down
2 changes: 1 addition & 1 deletion source/Userdocs/ImportingMorphologyFiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Usually, morphologies are embedded in NeuroML cell definition files, {ref}`for e

However, morphologies (and {ref}`biophysical properties <schema:biophysicalproperties>`) can also be stored as "standalone" entities outside the cell definition and referred to.
Further, they can also be stored in external files that may be "included" in the cell definition file (using the [IncludeType](https://libneuroml.readthedocs.io/en/latest/userdocs/coreclasses.html#includetype) model element).
This allows the re-use of morphology and biophysical properties in multiple cell models:
This allows the reuse of morphology and biophysical properties in multiple cell models:

```{code-block} xml
<cell id="pyr_soma_m_out_b_out" morphology="morph0" biophysicalProperties="biophys1">
Expand Down
Loading
Loading