@@ -12,37 +12,11 @@ using ..Engine: EMTFormulation, compute!, LineParameters
1212using .. DataModel: get_outer_radius
1313using Measurements: Measurement, measurement, value, uncertainty
1414using Random, Statistics, DataFrames
15- using Distributions: Distributions, ContinuousUnivariateDistribution, Normal, Uniform
16- using StatsBase: fit, Histogram, normalize, quantile
15+ using Distributions:
16+ Distributions, ContinuousUnivariateDistribution, Normal, Uniform, cdf, sampler
17+ using StatsBase: fit, Histogram, normalize, quantile, ecdf
1718using LinearAlgebra
1819
19- # ─────────────────────────────────────────────────────────────────────────────
20- # Random collapse of ranges → singleton specs + one-shot build
21- # ─────────────────────────────────────────────────────────────────────────────
22- # # - Any other symbol => hard error.
23- # @inline function _bounded_draw(lo::Real, hi::Real, distribution::Symbol = :normal)
24- # # - Given [lo, hi], interpret as ±1σ around μ = (lo+hi)/2, σ = (hi-lo)/2.
25- # lo_f = float(lo)
26- # hi_f = float(hi)
27- # @assert hi_f > lo_f "hi must be greater than lo"
28- # μ = (lo_f + hi_f) / 2
29- # σ = (hi_f - lo_f) / 2
30-
31- # if distribution === :normal
32- # # - :normal => Normal(μ, σ).
33- # return rand(Distributions.Normal(μ, σ))
34- # elseif distribution === :uniform
35- # # - :uniform => Uniform(μ ± √3 σ) so std matches σ.
36- # d = √3 * σ
37- # return rand(Distributions.Uniform(μ - d, μ + d))
38- # else
39- # throw(
40- # ArgumentError(
41- # "unsupported distribution: $(distribution). Use :uniform or :normal",
42- # ),
43- # )
44- # end
45- # end
4620
4721# Draw once from a "range-like" spec
4822# spec :: Number → return as-is
@@ -354,37 +328,6 @@ function collapse(
354328 )
355329end
356330
357- # function collapse(
358- # sbs::SystemBuilderSpec;
359- # distribution::Symbol = :normal,
360- # )
361- # scbs = collapse(sbs.builder; distribution = distribution)
362-
363- # # positions: keep anchors; collapse dx/dy/dspec pairs
364- # pos = [_collapse_position(p, distribution) for p in sbs.positions]
365-
366- # # system-level scalars-as-pairs
367- # L = _collapse_pair(_spec(sbs.length), distribution)
368- # T = _collapse_pair(_spec(sbs.temperature), distribution)
369-
370- # # earth
371- # er = sbs.earth
372- # ρ = _collapse_pair(_spec(er.rho), distribution)
373- # ε = _collapse_pair(_spec(er.eps_r), distribution)
374- # μ = _collapse_pair(_spec(er.mu_r), distribution)
375- # t = _collapse_pair(_spec(er.t), distribution)
376- # earth = typeof(er)(; rho = ρ, eps_r = ε, mu_r = μ, t = t)
377-
378- # return typeof(sbs)(
379- # sbs.system_id,
380- # scbs,
381- # pos;
382- # length = L,
383- # temperature = T,
384- # earth = earth,
385- # f = sbs.frequencies,
386- # )
387- # end
388331
389332"""
390333 sample(sbs::SystemBuilderSpec; distribution::Symbol = :uniform)
0 commit comments