desr 3.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- desr-3.0.0/CHANGELOG.md +289 -0
- desr-3.0.0/LICENSE +201 -0
- desr-3.0.0/MANIFEST.in +9 -0
- desr-3.0.0/PKG-INFO +102 -0
- desr-3.0.0/README.md +55 -0
- desr-3.0.0/desr/__init__.py +109 -0
- desr-3.0.0/desr/chemical_reaction_network.py +247 -0
- desr-3.0.0/desr/figures/__init__.py +34 -0
- desr-3.0.0/desr/figures/_palette.py +31 -0
- desr-3.0.0/desr/figures/flowchart.py +916 -0
- desr-3.0.0/desr/figures/symbol_map.py +828 -0
- desr-3.0.0/desr/matrix_normal_forms.py +787 -0
- desr-3.0.0/desr/numerics.py +1094 -0
- desr-3.0.0/desr/ode_system.py +4380 -0
- desr-3.0.0/desr/ode_translation.py +5687 -0
- desr-3.0.0/desr/symbol_graph.py +947 -0
- desr-3.0.0/desr/sympy_helper.py +345 -0
- desr-3.0.0/desr/tex_tools.py +630 -0
- desr-3.0.0/desr.egg-info/PKG-INFO +102 -0
- desr-3.0.0/desr.egg-info/SOURCES.txt +54 -0
- desr-3.0.0/desr.egg-info/dependency_links.txt +1 -0
- desr-3.0.0/desr.egg-info/requires.txt +5 -0
- desr-3.0.0/desr.egg-info/top_level.txt +1 -0
- desr-3.0.0/pyproject.toml +8 -0
- desr-3.0.0/setup.cfg +4 -0
- desr-3.0.0/setup.py +96 -0
- desr-3.0.0/tests/example_networks.py +261 -0
- desr-3.0.0/tests/oracles.py +52 -0
- desr-3.0.0/tests/random_systems.py +117 -0
- desr-3.0.0/tests/test_chemical_reaction_network.py +120 -0
- desr-3.0.0/tests/test_columns_by_monomial.py +155 -0
- desr-3.0.0/tests/test_definitions.py +376 -0
- desr-3.0.0/tests/test_edge_cases.py +245 -0
- desr-3.0.0/tests/test_example_networks.py +215 -0
- desr-3.0.0/tests/test_figures.py +236 -0
- desr-3.0.0/tests/test_full_row_rank.py +340 -0
- desr-3.0.0/tests/test_general_initial_conditions.py +335 -0
- desr-3.0.0/tests/test_hubert_labahn.py +163 -0
- desr-3.0.0/tests/test_inverse_multiplier.py +135 -0
- desr-3.0.0/tests/test_is_invariant.py +112 -0
- desr-3.0.0/tests/test_matrix_normal_forms.py +251 -0
- desr-3.0.0/tests/test_namespace.py +159 -0
- desr-3.0.0/tests/test_normal_forms_by_definition.py +109 -0
- desr-3.0.0/tests/test_numerics.py +368 -0
- desr-3.0.0/tests/test_numerics_series.py +491 -0
- desr-3.0.0/tests/test_ode_system.py +2453 -0
- desr-3.0.0/tests/test_ode_translation.py +2620 -0
- desr-3.0.0/tests/test_random_systems.py +550 -0
- desr-3.0.0/tests/test_refusals.py +252 -0
- desr-3.0.0/tests/test_scheme_equivalence.py +231 -0
- desr-3.0.0/tests/test_substitution.py +244 -0
- desr-3.0.0/tests/test_symbol_graph.py +1023 -0
- desr-3.0.0/tests/test_tex_parsing.py +768 -0
- desr-3.0.0/tests/test_unchanged_symbols.py +288 -0
- desr-3.0.0/tests/test_variable_classification.py +286 -0
- desr-3.0.0/tests/test_vocabulary.py +782 -0
desr-3.0.0/CHANGELOG.md
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Notes for releases before 3.0.0 are on the
|
|
4
|
+
[releases page](https://github.com/ofloveandhate/desr/releases).
|
|
5
|
+
|
|
6
|
+
## 3.0.0
|
|
7
|
+
|
|
8
|
+
Scaling symmetry reduction of ODE systems, after Hubert & Labahn (2013).
|
|
9
|
+
|
|
10
|
+
Not source-compatible with 2.x. A general-scheme reduction now produces a
|
|
11
|
+
different system: two steps that 2.x left undone are done by default, and
|
|
12
|
+
each can be turned off.
|
|
13
|
+
|
|
14
|
+
### Reductions
|
|
15
|
+
|
|
16
|
+
- `translate_general` normalises the parameter auxiliaries and identifies a
|
|
17
|
+
clock invariant with the independent variable, both by default, both
|
|
18
|
+
controlled by `normalise_parameters` and `rescale_clock`. Passing
|
|
19
|
+
`False` to each reproduces Hubert & Labahn's reduction exactly. The
|
|
20
|
+
options reach `translate` and `translate_dep_var` too.
|
|
21
|
+
- An auxiliary that is a monomial in the original parameters alone is
|
|
22
|
+
constant, so it can be set to 1. That is a choice of units, not an
|
|
23
|
+
assumption, and the choice is recorded in the caller's own symbols on
|
|
24
|
+
the reduced system's `normalisations`.
|
|
25
|
+
- `translate_general` and `translate_dep_var` take a system with initial
|
|
26
|
+
conditions. Each reduced
|
|
27
|
+
dependent starts at the value of its monomial at the start, stated in the
|
|
28
|
+
reduced parameters. A case with no such value is refused by name: the
|
|
29
|
+
independent variable in an invariant with a dependent that has an initial
|
|
30
|
+
condition, a dependent used as a unit, an invariant mixing dependents with
|
|
31
|
+
and without initial conditions, or a division by a zero initial value.
|
|
32
|
+
- A reduced system reports as parameters only the ones its equations use.
|
|
33
|
+
- The reduced clock is called `t` only when it denotes `t`. Where an
|
|
34
|
+
invariant has been identified with it, the clock is a rescaled time and
|
|
35
|
+
is named `tau`, as the parameter scheme already named the same quantity.
|
|
36
|
+
A reduction that identifies nothing keeps `t` — including every general
|
|
37
|
+
reduction that normalises nothing, and Hubert & Labahn 6.6, whose clock
|
|
38
|
+
invariants all involve a dependent variable.
|
|
39
|
+
- `substitutions()` writes each original symbol in the reduced system's own
|
|
40
|
+
symbols, under every scheme. It applies both of a reduction's steps, so
|
|
41
|
+
no image names a column the reduction spent.
|
|
42
|
+
- A system with no scaling symmetry has a scaling matrix with no rows, as
|
|
43
|
+
Hubert & Labahn's Proposition 5.1 gives it, and its reduction is the
|
|
44
|
+
identity. It used to be given a row of zeros, counted as one symmetry,
|
|
45
|
+
and reduced to equations that were not true. Reducing a reduced system
|
|
46
|
+
therefore returns it unchanged.
|
|
47
|
+
- A scaling matrix passed to `ODETranslator` must have full row rank, and
|
|
48
|
+
one that does not is refused.
|
|
49
|
+
- A reduced symbol that denotes the original symbol of the same name is
|
|
50
|
+
not a name clash.
|
|
51
|
+
- An invariant that is one of the original symbols keeps that symbol's
|
|
52
|
+
name: a dimensionless parameter, a clock the reduction does not rescale,
|
|
53
|
+
and every symbol of a system with no scaling symmetry, which therefore
|
|
54
|
+
reduces to itself. An auxiliary is always given a new name. Setting
|
|
55
|
+
`rename_unchanged_symbols` to `True` in the naming scheme gives every
|
|
56
|
+
invariant a generated name instead.
|
|
57
|
+
- `translate_dep_var` accepts a scaling matrix written over the symbols
|
|
58
|
+
other than the independent variable, as the same scaling with a zero
|
|
59
|
+
column there. This raised `IndexError` before. A matrix of any other
|
|
60
|
+
width is refused with a message that says so.
|
|
61
|
+
- `expected_symbol_count` is right for the dependent-variable scheme
|
|
62
|
+
when an auxiliary is a monomial in the parameters alone and is
|
|
63
|
+
normalised away. It returned `n` whatever the reduction did.
|
|
64
|
+
- `ODESystem.from_dict` and `from_equations` accept `initial_conditions`.
|
|
65
|
+
They raised `TypeError` for any value of it. `from_dict` no longer
|
|
66
|
+
adds the independent variable to the dict it is given.
|
|
67
|
+
- `smith_normal_form` is right for every integer matrix. It failed an
|
|
68
|
+
internal assertion on about one small matrix in ten.
|
|
69
|
+
- The general scheme takes an invariant `k*t`, with `k` a monomial in the
|
|
70
|
+
parameters, as its clock `tau` whenever there is one, and the reduced
|
|
71
|
+
system then has no `t`. This is a change of independent variable and
|
|
72
|
+
no longer waits on the normalisation making `k` equal to 1. With it
|
|
73
|
+
the general scheme gives the parameter scheme's system wherever that
|
|
74
|
+
scheme applies. `rescale_clock=False` keeps `t`.
|
|
75
|
+
- An invariant built from the parameters alone is named from the naming
|
|
76
|
+
scheme's `parameters` entry, `kappa` by default, under every scheme.
|
|
77
|
+
The general and dependent-variable schemes used to call it `y`.
|
|
78
|
+
- `NumericTranslator.reverse` returns the original time the reduced
|
|
79
|
+
values determine. Where the reduced clock denotes `t` it returned the
|
|
80
|
+
clock as given, which is the original time only when Hubert & Labahn's
|
|
81
|
+
constant `c` is 1; a reduced solution with another `c` came back with
|
|
82
|
+
the right values against the wrong times.
|
|
83
|
+
- `ODETranslator.isolate_clock()` puts the translator in a basis of the
|
|
84
|
+
invariants in which the independent variable appears in only one.
|
|
85
|
+
Where that one is `k*t`, an autonomous system reduces to an autonomous
|
|
86
|
+
one. It changes the translator, as the `multiplier_*` operations do,
|
|
87
|
+
and is something a caller asks for.
|
|
88
|
+
|
|
89
|
+
### Building a system and a translator
|
|
90
|
+
|
|
91
|
+
- `ODESystem` is built from forms that say which derivative belongs to
|
|
92
|
+
which symbol: `ODESystem({x: rate, ...})`,
|
|
93
|
+
`ODESystem(equations=['dx/dt = ...'])` or `ODESystem(tex=...)`. A bare
|
|
94
|
+
string is refused, since equations and LaTeX read some text differently,
|
|
95
|
+
and so are the parallel lists of variables and derivatives the
|
|
96
|
+
constructor used to take. `from_dict`, `from_equations` and `from_tex`
|
|
97
|
+
stay.
|
|
98
|
+
- A translator is the reduction of one system. `ODETranslator(system)`
|
|
99
|
+
builds it, and keeps a copy of the system; `from_ode_system` is gone,
|
|
100
|
+
without an alias. `ODETranslator(system, scaling_matrix=A)` reduces by
|
|
101
|
+
a scaling of one's own, and a matrix without the independent variable's
|
|
102
|
+
column is taken to have a zero there. A translator can no longer be
|
|
103
|
+
built from a bare matrix.
|
|
104
|
+
- No method takes a system. `translate`, `translate_parameter`,
|
|
105
|
+
`translate_dep_var`, `translate_general`, `isolate_clock` and
|
|
106
|
+
`expected_symbol_count` lost their `system` argument, as the methods
|
|
107
|
+
that report on a reduction had already: `scheme`, `invariant_names`,
|
|
108
|
+
`auxiliary_names`, `column_names`, `column_of`, `named_symbols`,
|
|
109
|
+
`symbol_kinds`, `variable_map`, `parameter_invariants` and
|
|
110
|
+
`dependent_invariants`. The options of `translate`, `translate_general`
|
|
111
|
+
and `translate_dep_var` are keyword-only, so a system passed where one
|
|
112
|
+
used to go is refused rather than read as a flag.
|
|
113
|
+
- `symbol_graph(translator, direction=...)` reads the translator's own
|
|
114
|
+
system, and takes no other.
|
|
115
|
+
- `extend_from_invariants` no longer takes `variables`, which read the
|
|
116
|
+
invariants in a different order from the scaling matrix's when the two
|
|
117
|
+
differed. `is_invariant_expr` no longer takes `variable_order`. Both existed for a
|
|
118
|
+
translator with no system.
|
|
119
|
+
- The dict for `ODESystem` and `from_dict` may hold names and expressions
|
|
120
|
+
as strings, read as `equations=` reads them.
|
|
121
|
+
- `extend_from_invariants` changes the translator it is called on, as the
|
|
122
|
+
`multiplier_*` operations and `isolate_clock` do, instead of returning a
|
|
123
|
+
new one. `translator.copy()` keeps the original; `copy.copy` shared the
|
|
124
|
+
multiplier before, and is now the same as `copy()`. The extension puts
|
|
125
|
+
the invariant columns in the order the schemes read them, and its
|
|
126
|
+
docstring says what is kept, what is chosen, what is completed and when
|
|
127
|
+
no completion exists. A choice that cannot be part of an integer basis
|
|
128
|
+
is refused in the chosen monomials' own terms.
|
|
129
|
+
- `order_invariant_columns()` puts the invariant columns in that order:
|
|
130
|
+
parameter invariants, then those with the independent variable, then
|
|
131
|
+
those with a dependent. After column operations it is what lets the
|
|
132
|
+
parameter scheme apply, where a page used to build the permutation by
|
|
133
|
+
hand.
|
|
134
|
+
- `ODESystem.subs` is one map applied to everything the system holds, all at once,
|
|
135
|
+
so the order of the pairs does not matter and `{x: y, y: x}` swaps two names.
|
|
136
|
+
The equations, initial conditions, constraints, same-unit requirements and
|
|
137
|
+
parameter values are all substituted, and the records of a reduced system
|
|
138
|
+
follow. A rename keeps the symbol's place, equation, value and kind, including
|
|
139
|
+
a dependent that no rate mentions, which used to vanish with its equation, and
|
|
140
|
+
a parameter, which used to move to the end of the parameter block and change
|
|
141
|
+
what was normalised. The independent variable can only be renamed.
|
|
142
|
+
It refuses: a dependent variable replaced by anything but a new name, since its
|
|
143
|
+
equation would need the chain rule (reduced systems used to allow this, and got
|
|
144
|
+
the equations wrong); a parameter made equal to something that moves; a rename
|
|
145
|
+
onto a name the system keeps, which gave it two symbols of one name; and any
|
|
146
|
+
number but 0, since a value such as `a = 2` holds in one choice of units and
|
|
147
|
+
substituting it loses the symmetry that rescales it -- record it with
|
|
148
|
+
`update_parameter_values` instead. Merging two parameters whose values differ
|
|
149
|
+
raises `ConflictingParameterValues`. `subs_constraints` and
|
|
150
|
+
`new_symbols_are_parameters` are gone.
|
|
151
|
+
- A dependent variable given a value in a relation read by `from_tex` or
|
|
152
|
+
`from_equations` is refused with the form a starting value takes, `x(0) = ...`.
|
|
153
|
+
- `translate` no longer takes `naming_scheme`. Set it at construction or
|
|
154
|
+
with `set_naming_scheme`, so one reduction cannot be named two ways.
|
|
155
|
+
- A reduced system carries what it needs to describe itself:
|
|
156
|
+
`named_symbols`, `symbol_kinds`, `normalisations`, `auxiliary_names`,
|
|
157
|
+
`forward_monomials` and `original_system`.
|
|
158
|
+
|
|
159
|
+
### Definitions
|
|
160
|
+
|
|
161
|
+
- A system is stated by four kinds of statement: equations; definitions,
|
|
162
|
+
`name := expression`; constraints among parameters the system has; and values.
|
|
163
|
+
A definition says what a name stands for. One in parameters alone gives a
|
|
164
|
+
parameter (`K_m := (k_m1 + k_2)/k_1`), which has a dimension and can be a unit.
|
|
165
|
+
One involving a variable gives an abbreviation (the cell cycle's `[Cdk]`): the
|
|
166
|
+
equations keep it as written, it is not a symbol, and every computation writes it
|
|
167
|
+
out, so the symmetries are those of the expanded equations. A definition that does
|
|
168
|
+
not scale consistently under them is refused, and so is a cycle, by name.
|
|
169
|
+
- The order of statements does not matter: a name used before it is defined is
|
|
170
|
+
settled once it is. `add_definition` adds a definition, and `definitions` and
|
|
171
|
+
`abbreviations` read them. `from_tex` reads `:=` and `\coloneqq`, and
|
|
172
|
+
`from_equations` reads `:=`, alongside initial conditions, values and constraints.
|
|
173
|
+
`repr` prints a definition as `name := expression`, and `to_tex` as `&:=`.
|
|
174
|
+
`from_tex(..., sub_defns=True)` is gone: the definitions are kept instead of
|
|
175
|
+
substituted.
|
|
176
|
+
- `add_constraint` relates parameters the system already has. A new name is
|
|
177
|
+
refused, pointing to `add_definition`, and so are variables and abbreviations.
|
|
178
|
+
- `subs` naming an expression (`{a_2 + a_12: b_22}`) records the definition, so the
|
|
179
|
+
system keeps the model's symmetries: two for the linear compartment model, where
|
|
180
|
+
the lumped model written directly has three. A definition that a substitution
|
|
181
|
+
makes refer to itself becomes a constraint. A defined name may be replaced by what
|
|
182
|
+
its definition becomes, and by nothing else. `subs` only substitutes;
|
|
183
|
+
`expanded()` and `factored()` rewrite the equations.
|
|
184
|
+
- A reduction carries the definitions through. A defined parameter's image is
|
|
185
|
+
defined in the reduced parameters (`kappa2 := kappa1 + 1`). An abbreviation
|
|
186
|
+
becomes an abbreviation of the reduced system, written in its symbols and named
|
|
187
|
+
with the naming scheme's new `definitions` suffix, `_tilde` by default
|
|
188
|
+
(`Cdk_tilde := 1 - nu2 - nu3`). Under the parameter scheme the reduced equations
|
|
189
|
+
are written with them, each checked against the expanded reduction.
|
|
190
|
+
- `to_tex` typesets a name ending in `_tilde`, `_hat` or `_bar` with that accent,
|
|
191
|
+
wide over a name of more than one letter: `k_25_tilde` is `\tilde{k}_{25}` and
|
|
192
|
+
`Cdk_tilde` is `\widetilde{Cdk}`.
|
|
193
|
+
|
|
194
|
+
### Dimensions
|
|
195
|
+
|
|
196
|
+
- `ODESystem.dimensions_of()` gives each symbol's structural dimension,
|
|
197
|
+
derived from the scaling matrix with nothing declared. They are written
|
|
198
|
+
`[t]`, after the symbol that names the direction.
|
|
199
|
+
- `set_dimension`, `set_dimensions` and `physical_dimensions_of()` are the
|
|
200
|
+
overlay: declare `[t] = time` and the rest follows. Naming changes no
|
|
201
|
+
matrix. Every symbol gets a dimension: where the declarations reach, in
|
|
202
|
+
the names declared; where they do not, the rest keeps desr's own name,
|
|
203
|
+
so declaring only time leaves `k_1: 1/([e_0]*time)`. With nothing
|
|
204
|
+
declared it is `dimensions_of()`.
|
|
205
|
+
- `scaling_symmetries()` reports a symmetry as an action —
|
|
206
|
+
`t -> lamda*t, k_2 -> k_2/lamda` — checked against the equations.
|
|
207
|
+
- `unit_table()` is the reduction's symbols with what each denotes, what it
|
|
208
|
+
measures and what it is measured in. `num_units_and_dimensions()` counts
|
|
209
|
+
them: a reduction coins `r` units measuring however many dimensions.
|
|
210
|
+
- Also `dimension_of`, `dimension_matrix`, `symbols_by_dimension`,
|
|
211
|
+
`dimensionless_expressions`, `exponent_matrix_hnf` and
|
|
212
|
+
`scaling_symmetry_rows`.
|
|
213
|
+
|
|
214
|
+
### Figures
|
|
215
|
+
|
|
216
|
+
- `desr.figures.flowchart_figure` draws a reduction as nine numbered boxes
|
|
217
|
+
of matrices, page-text wide and as tall as it needs.
|
|
218
|
+
- `desr.figures.symbol_map_figure` draws it as a chain of five systems and
|
|
219
|
+
the four maps between them. Its width is measured from what is in it,
|
|
220
|
+
so a small system gives a figure about one page-text wide; `size` sets
|
|
221
|
+
it by hand.
|
|
222
|
+
- A dependent variable with an initial condition is shown where it starts.
|
|
223
|
+
The symbol graph's nodes carry `initial_value`, and the parameter that is
|
|
224
|
+
an initial value carries `initial_value_of` and is drawn as
|
|
225
|
+
`s_0 = s(0)`. A reduction that refuses the initial conditions still has
|
|
226
|
+
a graph, which records the reason as `initial_conditions_refused`.
|
|
227
|
+
- `desr.symbol_graph` is the exponent graph both are built on, with
|
|
228
|
+
`ODETranslator.symbol_graph` and `draw_symbol_graph` as the way in.
|
|
229
|
+
- Neither figure computes anything. Every matrix, monomial, dimension and
|
|
230
|
+
substitution on either page comes from a getter, so a figure drawn for a
|
|
231
|
+
model desr has never seen is as right as the library is.
|
|
232
|
+
|
|
233
|
+
### Renames
|
|
234
|
+
|
|
235
|
+
- The option `identify_indep_var` is `rescale_clock`, on `translate`,
|
|
236
|
+
`translate_general`, `translate_dep_var` and `expected_symbol_count`.
|
|
237
|
+
The step takes an invariant `k*t` as the clock; it no longer identifies
|
|
238
|
+
an invariant with `t`. There is no alias.
|
|
239
|
+
- `NumericTranslation` is `NumericTranslator`, and is built from a reduced
|
|
240
|
+
system rather than from a system and a translator.
|
|
241
|
+
`ODESystem.numeric_translator()` is the short way to one.
|
|
242
|
+
- `symbols_that_must_not_be_zero` and
|
|
243
|
+
`reduced_symbols_that_must_not_be_zero` are
|
|
244
|
+
`forward_symbols_that_must_not_be_zero` and
|
|
245
|
+
`reverse_symbols_that_must_not_be_zero`, named for the direction rather
|
|
246
|
+
than for the symbol set. The old `reduced_` name claimed the reduced
|
|
247
|
+
system's symbols and returned the column names, which include the columns
|
|
248
|
+
a reduction spends.
|
|
249
|
+
- `translate_parameter_substitutions` is gone. `substitutions()` gives the
|
|
250
|
+
same dict, in the same order, wherever the parameter scheme applies, and
|
|
251
|
+
holds under every scheme, where the old method refused all but one. It
|
|
252
|
+
takes no system: it reports on the one the translator was built from.
|
|
253
|
+
There is no alias.
|
|
254
|
+
- `reorder_variables`, `default_order_variables`, `expected_variable_count`
|
|
255
|
+
and `equation_variables` are `reorder_symbols`, `default_order_symbols`,
|
|
256
|
+
`expected_symbol_count` and `constraint_symbols`. Each orders, counts or
|
|
257
|
+
collects symbols, parameters included, and a variable is a symbol that
|
|
258
|
+
varies. There are no aliases.
|
|
259
|
+
- `column_monomials` is `forward_monomials`, beside `reverse_monomials`.
|
|
260
|
+
- `indep_var_invariant` is `indep_var_invariants`, and returns all of them.
|
|
261
|
+
- `units_and_dimensions` is `num_units_and_dimensions`, because it counts.
|
|
262
|
+
- `r` keeps working, and `num_scaling_symmetries` says what it is.
|
|
263
|
+
|
|
264
|
+
### The short ways
|
|
265
|
+
|
|
266
|
+
- `system.reduce_scaling_symmetries()` is
|
|
267
|
+
`ODETranslator(system).translate()`, and
|
|
268
|
+
`system.translator()` is the translator. Each is exactly the lines it
|
|
269
|
+
stands for.
|
|
270
|
+
- `ConflictingParameterValues` and `TexParseError` are exported from the
|
|
271
|
+
package, with the two numeric exceptions, so every exception the
|
|
272
|
+
library defines can be caught with one import.
|
|
273
|
+
- Symbols are made with `to_symbol` throughout. `sympy.var`, which
|
|
274
|
+
also writes each name into a module's globals, is no longer used.
|
|
275
|
+
|
|
276
|
+
### Packaging
|
|
277
|
+
|
|
278
|
+
- `desr` is on PyPI: `pip install desr`. `pyproject.toml` declares the build
|
|
279
|
+
system, and the metadata carries classifiers, keywords and the licence as
|
|
280
|
+
an SPDX expression.
|
|
281
|
+
|
|
282
|
+
- numpy, scipy and networkx are requirements, for `desr.numerics` and the
|
|
283
|
+
symbol graph. matplotlib is not: the figures need it, and drawing
|
|
284
|
+
without it says so. `import desr` loads none of the four, and CI checks
|
|
285
|
+
a bare install.
|
|
286
|
+
- `desr.figures` ships with the package.
|
|
287
|
+
|
|
288
|
+
Every change since 2.0.3:
|
|
289
|
+
[v2.0.3...v3.0.0](https://github.com/ofloveandhate/desr/compare/v2.0.3...v3.0.0).
|
desr-3.0.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright {yyyy} {name of copyright owner}
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
desr-3.0.0/MANIFEST.in
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# What the source distribution carries besides the package: the changelog, and the tests,
|
|
2
|
+
# so that someone who unpacks it can run them. README.md and LICENSE are included by
|
|
3
|
+
# setuptools itself.
|
|
4
|
+
#
|
|
5
|
+
# Not tests/test_repository.py: it tests the repository's own tooling and reads files the
|
|
6
|
+
# archive does not carry, and every test shipped has to run from the archive alone.
|
|
7
|
+
include CHANGELOG.md
|
|
8
|
+
recursive-include tests *.py
|
|
9
|
+
exclude tests/test_repository.py
|
desr-3.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: desr
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: Simplify ordinary differential equations by finding scaling symmetries.
|
|
5
|
+
Author: Richard Tanburn, Silviana Amethyst
|
|
6
|
+
Maintainer: Silviana Amethyst
|
|
7
|
+
Maintainer-email: amethyst@mpi-cbg.de
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
Project-URL: DOI, https://doi.org/10.5281/zenodo.17671203
|
|
10
|
+
Project-URL: Source, https://github.com/ofloveandhate/desr
|
|
11
|
+
Project-URL: Issues, https://github.com/ofloveandhate/desr/issues
|
|
12
|
+
Project-URL: Documentation, https://desr.readthedocs.io
|
|
13
|
+
Project-URL: Institutional mirror, https://git.mpi-cbg.de/ASB/desr
|
|
14
|
+
Keywords: nondimensionalization,scaling symmetry,ordinary differential equations,symmetry reduction,Hermite normal form
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: sympy
|
|
30
|
+
Requires-Dist: python-flint>=0.7
|
|
31
|
+
Requires-Dist: numpy
|
|
32
|
+
Requires-Dist: scipy
|
|
33
|
+
Requires-Dist: networkx
|
|
34
|
+
Dynamic: author
|
|
35
|
+
Dynamic: classifier
|
|
36
|
+
Dynamic: description
|
|
37
|
+
Dynamic: description-content-type
|
|
38
|
+
Dynamic: keywords
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
Dynamic: license-expression
|
|
41
|
+
Dynamic: maintainer
|
|
42
|
+
Dynamic: maintainer-email
|
|
43
|
+
Dynamic: project-url
|
|
44
|
+
Dynamic: requires-dist
|
|
45
|
+
Dynamic: requires-python
|
|
46
|
+
Dynamic: summary
|
|
47
|
+
|
|
48
|
+
# desr
|
|
49
|
+
|
|
50
|
+
[](https://doi.org/10.5281/zenodo.17671203)
|
|
51
|
+
|
|
52
|
+
*desr* is a package used for Differential Equation Symmetry Reduction and is particularly useful for reducing the number of parameters in dynamical systems. It implements algorithms outlined by Evelyne Hubert and George Labahn <sup>[1](#myfootnote1)</sup>. See the full documentation on [readthedocs](https://desr.readthedocs.io).
|
|
53
|
+
|
|
54
|
+
This package accompanies a paper "Nondimensionalisation is more science than art". The Masters dissertation [Differential Algebra and Applications](http://tanbur.github.io/desr/dissertation/differential_algebra_and_applications.pdf) that this code originally accompanied places the algorithms into the theoretical framework of <em>differential algebraic geometry</em> and shows how to extend them to parameter reduction of arbitrary systems of partial differential equations, though this is not yet implemented.
|
|
55
|
+
|
|
56
|
+
<a name="myfootnote1">1</a>: Hubert, E., & Labahn, G. (2013). Scaling Invariants and Symmetry Reduction of Dynamical Systems. Foundations of Computational Mathematics, 13(4), 479–516. http://doi.org/10.1007/s10208-013-9165-9
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## Getting Started
|
|
60
|
+
|
|
61
|
+
### Installing
|
|
62
|
+
|
|
63
|
+
From PyPI:
|
|
64
|
+
|
|
65
|
+
`$ pip install desr`
|
|
66
|
+
|
|
67
|
+
The figures also need matplotlib, which desr does not install:
|
|
68
|
+
|
|
69
|
+
`$ pip install matplotlib`
|
|
70
|
+
|
|
71
|
+
From a clone of the repository:
|
|
72
|
+
|
|
73
|
+
`$ pip install .`
|
|
74
|
+
|
|
75
|
+
## Running the tests
|
|
76
|
+
|
|
77
|
+
From a clone of the repository, with matplotlib and pytest installed:
|
|
78
|
+
|
|
79
|
+
`$ python -m pytest tests/`
|
|
80
|
+
|
|
81
|
+
The worked examples in the documentation are doctests too: `python -m sphinx -b doctest docs/source docs/build/doctest`.
|
|
82
|
+
|
|
83
|
+
## Built With
|
|
84
|
+
|
|
85
|
+
* [Sphinx](http://www.sphinx-doc.org/en/stable/) - Used to generate the docs.
|
|
86
|
+
|
|
87
|
+
## Contributing
|
|
88
|
+
|
|
89
|
+
Submissions for contribution are always welcome.
|
|
90
|
+
|
|
91
|
+
## Authors
|
|
92
|
+
|
|
93
|
+
* **Richard Tanburn** - *Initial work* - [tanbur](https://github.com/tanbur)
|
|
94
|
+
* **Silviana Amethyst** - *Revisions, bugfixes, maintenance, 2025-* - [ofloveandhate](https://github.com/ofloveandhate)
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
This project is licensed under the Apache 2.0 License - see the [LICENSE](https://github.com/ofloveandhate/desr/blob/main/LICENSE) file for details
|
|
99
|
+
|
|
100
|
+
## Acknowledgments
|
|
101
|
+
|
|
102
|
+
* Dr. Heather Harrington and Dr. Emilie Dufresne for their supervision of the dissertation.
|
desr-3.0.0/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# desr
|
|
2
|
+
|
|
3
|
+
[](https://doi.org/10.5281/zenodo.17671203)
|
|
4
|
+
|
|
5
|
+
*desr* is a package used for Differential Equation Symmetry Reduction and is particularly useful for reducing the number of parameters in dynamical systems. It implements algorithms outlined by Evelyne Hubert and George Labahn <sup>[1](#myfootnote1)</sup>. See the full documentation on [readthedocs](https://desr.readthedocs.io).
|
|
6
|
+
|
|
7
|
+
This package accompanies a paper "Nondimensionalisation is more science than art". The Masters dissertation [Differential Algebra and Applications](http://tanbur.github.io/desr/dissertation/differential_algebra_and_applications.pdf) that this code originally accompanied places the algorithms into the theoretical framework of <em>differential algebraic geometry</em> and shows how to extend them to parameter reduction of arbitrary systems of partial differential equations, though this is not yet implemented.
|
|
8
|
+
|
|
9
|
+
<a name="myfootnote1">1</a>: Hubert, E., & Labahn, G. (2013). Scaling Invariants and Symmetry Reduction of Dynamical Systems. Foundations of Computational Mathematics, 13(4), 479–516. http://doi.org/10.1007/s10208-013-9165-9
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Getting Started
|
|
13
|
+
|
|
14
|
+
### Installing
|
|
15
|
+
|
|
16
|
+
From PyPI:
|
|
17
|
+
|
|
18
|
+
`$ pip install desr`
|
|
19
|
+
|
|
20
|
+
The figures also need matplotlib, which desr does not install:
|
|
21
|
+
|
|
22
|
+
`$ pip install matplotlib`
|
|
23
|
+
|
|
24
|
+
From a clone of the repository:
|
|
25
|
+
|
|
26
|
+
`$ pip install .`
|
|
27
|
+
|
|
28
|
+
## Running the tests
|
|
29
|
+
|
|
30
|
+
From a clone of the repository, with matplotlib and pytest installed:
|
|
31
|
+
|
|
32
|
+
`$ python -m pytest tests/`
|
|
33
|
+
|
|
34
|
+
The worked examples in the documentation are doctests too: `python -m sphinx -b doctest docs/source docs/build/doctest`.
|
|
35
|
+
|
|
36
|
+
## Built With
|
|
37
|
+
|
|
38
|
+
* [Sphinx](http://www.sphinx-doc.org/en/stable/) - Used to generate the docs.
|
|
39
|
+
|
|
40
|
+
## Contributing
|
|
41
|
+
|
|
42
|
+
Submissions for contribution are always welcome.
|
|
43
|
+
|
|
44
|
+
## Authors
|
|
45
|
+
|
|
46
|
+
* **Richard Tanburn** - *Initial work* - [tanbur](https://github.com/tanbur)
|
|
47
|
+
* **Silviana Amethyst** - *Revisions, bugfixes, maintenance, 2025-* - [ofloveandhate](https://github.com/ofloveandhate)
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
This project is licensed under the Apache 2.0 License - see the [LICENSE](https://github.com/ofloveandhate/desr/blob/main/LICENSE) file for details
|
|
52
|
+
|
|
53
|
+
## Acknowledgments
|
|
54
|
+
|
|
55
|
+
* Dr. Heather Harrington and Dr. Emilie Dufresne for their supervision of the dissertation.
|