| 365 domain, sensor_count, ref noise_distr, sensor, spread, kernel, |
365 domain, sensor_count, ref noise_distr, sensor, spread, kernel, |
| 366 ref μ_hat, /*regularisation,*/ kernel_plot_width, dataterm, noise_seed, |
366 ref μ_hat, /*regularisation,*/ kernel_plot_width, dataterm, noise_seed, |
| 367 .. |
367 .. |
| 368 } |
368 } |
| 369 } = self; |
369 } = self; |
| 370 #[allow(deprecated)] |
|
| 371 let regularisation = $reg_convert(self.data.$reg_field); |
370 let regularisation = $reg_convert(self.data.$reg_field); |
| 372 |
371 |
| 373 println!("{}\n{}", |
372 println!("{}\n{}", |
| 374 format!("Performing experiment {}…", experiment_name).cyan(), |
373 format!("Performing experiment {}…", experiment_name).cyan(), |
| 375 format!("{:?}", &self.data).bright_black()); |
374 format!("{:?}", &self.data).bright_black()); |
| 653 let pfx = |n| format!("{}{}", prefix, n); |
652 let pfx = |n| format!("{}{}", prefix, n); |
| 654 μ_hat.write_csv(pfx("orig.txt"))?; |
653 μ_hat.write_csv(pfx("orig.txt"))?; |
| 655 opA.write_observable(&b_hat, pfx("b_hat"))?; |
654 opA.write_observable(&b_hat, pfx("b_hat"))?; |
| 656 opA.write_observable(&b, pfx("b_noisy")) |
655 opA.write_observable(&b, pfx("b_noisy")) |
| 657 } |
656 } |
| 658 |
|
| 659 // |
|
| 660 // Deprecated interface |
|
| 661 // |
|
| 662 |
|
| 663 /// Struct for experiment configurations |
|
| 664 #[derive(Debug, Clone, Serialize)] |
|
| 665 pub struct Experiment<F, NoiseDistr, S, K, P, const N : usize> |
|
| 666 where F : Float, |
|
| 667 [usize; N] : Serialize, |
|
| 668 NoiseDistr : Distribution<F>, |
|
| 669 S : Sensor<F, N>, |
|
| 670 P : Spread<F, N>, |
|
| 671 K : SimpleConvolutionKernel<F, N>, |
|
| 672 { |
|
| 673 /// Domain $Ω$. |
|
| 674 pub domain : Cube<F, N>, |
|
| 675 /// Number of sensors along each dimension |
|
| 676 pub sensor_count : [usize; N], |
|
| 677 /// Noise distribution |
|
| 678 pub noise_distr : NoiseDistr, |
|
| 679 /// Seed for random noise generation (for repeatable experiments) |
|
| 680 pub noise_seed : u64, |
|
| 681 /// Sensor $θ$; $θ * ψ$ forms the forward operator $𝒜$. |
|
| 682 pub sensor : S, |
|
| 683 /// Spread $ψ$; $θ * ψ$ forms the forward operator $𝒜$. |
|
| 684 pub spread : P, |
|
| 685 /// Kernel $ρ$ of $𝒟$. |
|
| 686 pub kernel : K, |
|
| 687 /// True point sources |
|
| 688 pub μ_hat : DiscreteMeasure<Loc<F, N>, F>, |
|
| 689 /// Regularisation parameter |
|
| 690 #[deprecated(note = "Use [`ExperimentV2`], which replaces `α` by more generic `regularisation`")] |
|
| 691 pub α : F, |
|
| 692 /// For plotting : how wide should the kernels be plotted |
|
| 693 pub kernel_plot_width : F, |
|
| 694 /// Data term |
|
| 695 pub dataterm : DataTerm, |
|
| 696 /// A map of default configurations for algorithms |
|
| 697 #[serde(skip)] |
|
| 698 pub algorithm_defaults : HashMap<DefaultAlgorithm, AlgorithmConfig<F>>, |
|
| 699 } |
|
| 700 |
|
| 701 impl_experiment!(Experiment, α, Regularisation::NonnegRadon); |
|