|
95 | 95 | # If the input is given in a map form, the vector needs sorting and the first value removed.
|
96 | 96 | # The creates a Vector{Vector{Value}} or Vector{value} form, which is then again sent to lattice_process_input for reprocessing.
|
97 | 97 | function lattice_process_input(input::Vector{<:Pair}, syms::Vector{BasicSymbolic{Real}}, args...)
|
98 |
| - isempty(setdiff(first.(input), syms)) || error("Some input symbols are not recognised: $(setdiff(first.(input), syms)).") |
| 98 | + if !isempty(setdiff(first.(input), syms)) |
| 99 | + error("Some input symbols are not recognised: $(setdiff(first.(input), syms)).") |
| 100 | + end |
99 | 101 | sorted_input = sort(input; by = p -> findfirst(isequal(p[1]), syms))
|
100 | 102 | return lattice_process_input(last.(sorted_input), syms, args...)
|
101 | 103 | end
|
@@ -148,7 +150,7 @@ function duplicate_trans_params!(edge_ps::Vector{Vector{Float64}}, lrs::LatticeR
|
148 | 150 |
|
149 | 151 | # A vector where we will put the edge parameters new values.
|
150 | 152 | # Has the correct length (the number of directed edges in the lattice).
|
151 |
| - new_vals = Vector{Float64}(undef,lrs.num_edges) |
| 153 | + new_vals = Vector{Float64}(undef, lrs.num_edges) |
152 | 154 | # As we loop through the edges of the di-graph, this keeps track of each edge's index in the original graph.
|
153 | 155 | original_edge_count = 0
|
154 | 156 | for edge in edges(lrs.lattice) # For each edge.
|
|
219 | 221 |
|
220 | 222 | # Creates a map, taking each species (with transportation) to its transportation rate.
|
221 | 223 | # The species is represented by its index (in species(lrs).
|
222 |
| -# If the rate is uniform across all edges, the vector will be length 1 (with this value), else there will be a separate value for each edge. |
| 224 | +# If the rate is uniform across all edges, the vector will be length 1 (with this value), |
| 225 | +# else there will be a separate value for each edge. |
223 | 226 | # Pair{Int64, Vector{T}}[] is required in case vector is empty (otherwise it becomes Any[], causing type error later).
|
224 |
| -function make_sidxs_to_transrate_map(vert_ps::Vector{Vector{Float64}}, edge_ps::Vector{Vector{T}}, lrs::LatticeReactionSystem) where T |
| 227 | +function make_sidxs_to_transrate_map(vert_ps::Vector{Vector{Float64}}, edge_ps::Vector{Vector{T}}, |
| 228 | + lrs::LatticeReactionSystem) where T |
225 | 229 | transport_rates_speciesmap = compute_all_transport_rates(vert_ps, edge_ps, lrs)
|
226 | 230 | return Pair{Int64, Vector{T}}[
|
227 | 231 | speciesmap(lrs.rs)[spat_rates[1]] => spat_rates[2] for spat_rates in transport_rates_speciesmap
|
|
0 commit comments