Skip to content

Commit 387e0bc

Browse files
committed
add news and update docs
1 parent 1685218 commit 387e0bc

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

NEWS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# NetworkDynamics Release Notes
22

3+
## v0.10.2 Changelog
4+
- [#299](https://github.com/JuliaDynamics/NetworkDynamics.jl/pull/299) enhance metadata system with pattern matching and utility functions:
5+
- Add String/Regex pattern matching for all metadata functions (`has_metadata`, `get_metadata`, `set_metadata!`, etc.)
6+
- Add `strip_*!` functions to remove all metadata of a specific type from components
7+
- Add `free_u()` and `free_p()` functions to identify variables/parameters without default values
8+
- Support removing metadata by passing `nothing` or `missing` to `set_*!` functions
9+
310
## v0.10.1 Changelog
411
- [#294](https://github.com/JuliaDynamics/NetworkDynamics.jl/pull/294) add linear stability analysis functions: `isfixpoint`, `jacobian_eigenvals`, and `is_linear_stable` with support for both ODE and DAE systems
512
- [#283](https://github.com/JuliaDynamics/NetworkDynamics.jl/pull/283) add automatic sparsity detection using `get_jac_prototype` and `set_jac_prototype!`

docs/src/metadata.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ details.
2222
## Symbol Metadata
2323
Each component stores symbol metadata. The symbol metadata is a `Dict{Symbol, Dict{Symbol, Any}}` which stores a metadata dict per symbol. Symbols are everything that appears in [`sym`](@ref), [`psym`](@ref), [`obssym`](@ref) and [`insym`](@ref).
2424

25-
To access the data, you can use the methods `has_metadata`, `get_metadata`, `set_metadata!` and `delete_metadata!` (see [Per Symbol Metadata API](@ref)).
25+
To access the data, you can use the methods `has_metadata`, `get_metadata`, `set_metadata!` and `delete_metadata!` (see [Per Symbol Metadata API](@ref)). These functions also support pattern matching using String or Regex patterns to match symbol names, making it easier to work with symbols containing special characters or when you only know part of the symbol name.
2626

2727
Special cases for symbol metadata are:
2828

@@ -31,7 +31,7 @@ Special cases for symbol metadata are:
3131
- `bounds`: Stores bounds for variables/parameters
3232
- `init`: Stores the solution of the "free" variables, this is rarely set manually but instead when calling [`initialize_component!`](@ref).
3333

34-
For those, there are special functions `has_*`, `get_*`, `set_*!` and `delete_*!`. See [Per Symbol Metadata API](@ref).
34+
For those, there are special functions `has_*`, `get_*`, `set_*!`, `delete_*!` and `strip_*!`. The `strip_*!` functions remove all metadata of a specific type from all symbols in a component. See [Per Symbol Metadata API](@ref).
3535

3636
These are closely aligned with the [metadata use in ModelingToolkit](@extref ModelingToolkit symbolic_metadata). They are automatically copied from the `ODESystem` if you use MTK models to create NetworkDynamics models.
3737

@@ -42,5 +42,7 @@ common task. We provide several helper methods to do so. Please check out their
4242
- [`dump_state`](@ref)
4343
- [`dump_initial_state`](@ref)
4444
- [`get_initial_state`](@ref)
45+
- [`free_u`](@ref) - find variables without default values
46+
- [`free_p`](@ref) - find parameters without default values
4547
- [`describe_vertices`](@ref) (needs `DataFrames.jl` loaded)
4648
- [`describe_edges`](@ref) (needs `DataFrames.jl` loaded)

src/metadata.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ or for a symbol referenced by `sni` in a network.
9595
For component models, you can also use a `String` or `Regex` pattern to match symbol names:
9696
- String patterns use substring matching (e.g., `"δ"` matches `machine₊δ`)
9797
- Regex patterns use full regex matching (e.g., `r"P\$"` matches symbols ending with "P")
98-
This will error if there is none or multile matches.
98+
This will error if there are none or multiple matches.
9999
100100
If the pattern matches multiple symbols, an error is thrown. Use a more specific pattern.
101101
Throws an error if the symbol does not exist in the component model.

0 commit comments

Comments
 (0)