From 0d32374ac035800fa204dd9929a32036a79f5fb5 Mon Sep 17 00:00:00 2001 From: Ameyanagi <77273474+Ameyanagi@users.noreply.github.com> Date: Tue, 6 Feb 2024 09:10:13 -0500 Subject: [PATCH] add serde --- Cargo.lock | 262 +++++++++++++++++++++++++++++++++++++- Cargo.toml | 6 +- src/main.rs | 18 ++- src/xafs/background.rs | 7 +- src/xafs/mathutils.rs | 4 - src/xafs/normalization.rs | 7 +- src/xafs/xafsutils.rs | 20 ++- src/xafs/xasgroup.rs | 3 +- src/xafs/xasspectrum.rs | 5 +- src/xafs/xrayfft.rs | 34 ++++- 10 files changed, 336 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 556d6de..33d9327 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,6 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", + "const-random", "getrandom", "once_cell", "version_check", @@ -39,6 +40,21 @@ dependencies = [ "memchr", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anes" version = "0.1.6" @@ -93,6 +109,71 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "arrow-array" +version = "46.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "226fdc6c3a4ae154a74c24091d36a90b514f0ed7112f5b8322c1d8f354d8e20d" +dependencies = [ + "ahash", + "arrow-buffer", + "arrow-data", + "arrow-schema", + "chrono", + "half 2.3.1", + "hashbrown", + "num", +] + +[[package]] +name = "arrow-buffer" +version = "46.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc4843af4dd679c2f35b69c572874da8fde33be53eb549a5fb128e7a4b763510" +dependencies = [ + "bytes", + "half 2.3.1", + "num", +] + +[[package]] +name = "arrow-data" +version = "46.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da900f31ff01a0a84da0572209be72b2b6f980f3ea58803635de47913191c188" +dependencies = [ + "arrow-buffer", + "arrow-schema", + "half 2.3.1", + "num", +] + +[[package]] +name = "arrow-schema" +version = "46.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b104f5daa730f00fde22adc03a12aa5a2ae9ccbbf99cbd53d284119ddc90e03d" + +[[package]] +name = "arrow2" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59c468daea140b747d781a1da9f7db5f0a8e6636d4af20cc539e43d05b0604fa" +dependencies = [ + "ahash", + "bytemuck", + "chrono", + "dyn-clone", + "either", + "ethnum", + "foreign_vec", + "getrandom", + "hash_hasher", + "num-traits", + "rustc_version", + "simdutf8", +] + [[package]] name = "assert_float_eq" version = "1.1.3" @@ -149,6 +230,26 @@ name = "bytemuck" version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cast" @@ -192,6 +293,20 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-targets", +] + [[package]] name = "ciborium" version = "0.2.1" @@ -216,7 +331,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b" dependencies = [ "ciborium-io", - "half", + "half 1.8.2", ] [[package]] @@ -244,6 +359,32 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +[[package]] +name = "const-random" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aaf16c9c2c612020bcfd042e170f6e32de9b9d75adb5277cdbbd2e2c8c8299a" +dependencies = [ + "const-random-macro", +] + +[[package]] +name = "const-random-macro" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +dependencies = [ + "getrandom", + "once_cell", + "tiny-keccak", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + [[package]] name = "cpp_demangle" version = "0.4.3" @@ -322,6 +463,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "data_reader" version = "0.5.0" @@ -343,6 +490,12 @@ dependencies = [ "uuid", ] +[[package]] +name = "dyn-clone" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" + [[package]] name = "easyfft" version = "0.2.3" @@ -411,6 +564,12 @@ dependencies = [ "num-complex 0.4.3", ] +[[package]] +name = "ethnum" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" + [[package]] name = "fastrand" version = "2.0.1" @@ -442,6 +601,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "foreign_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee1b05cbd864bcaecbd3455d6d967862d446e4ebfc3c2e5e5b9841e53cba6673" + [[package]] name = "generic_singleton" version = "0.1.3" @@ -469,8 +634,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -485,6 +652,24 @@ version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" +[[package]] +name = "half" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872" +dependencies = [ + "bytemuck", + "cfg-if", + "crunchy", + "num-traits", +] + +[[package]] +name = "hash_hasher" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74721d007512d0cb3338cd20f0654ac913920061a4c4d0d8708edb3f2a698c0c" + [[package]] name = "hashbrown" version = "0.14.2" @@ -497,6 +682,29 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +[[package]] +name = "iana-time-zone" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "indexmap" version = "2.1.0" @@ -868,6 +1076,7 @@ dependencies = [ "num-integer", "num-traits", "rawpointer 0.2.1", + "serde", ] [[package]] @@ -1354,18 +1563,35 @@ checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" [[package]] name = "serde" -version = "1.0.171" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] +[[package]] +name = "serde_arrow" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2d76aa4d71cc3139e15f52dbe647a28fda74c1722c07e983ec394cb2b939f59" +dependencies = [ + "arrow-array", + "arrow-buffer", + "arrow-data", + "arrow-schema", + "arrow2", + "bytemuck", + "chrono", + "half 2.3.1", + "serde", +] + [[package]] name = "serde_derive" -version = "1.0.171" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", @@ -1409,6 +1635,12 @@ dependencies = [ "wide", ] +[[package]] +name = "simdutf8" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" + [[package]] name = "smallvec" version = "1.11.1" @@ -1517,6 +1749,15 @@ dependencies = [ "syn 2.0.39", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinytemplate" version = "1.2.1" @@ -1691,6 +1932,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -1778,6 +2028,8 @@ dependencies = [ "pprof", "rayon", "rusty-fitpack", + "serde", + "serde_arrow", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 4389a08..a5b70ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,15 +11,17 @@ data_reader = "0.5.0" easyfft = "0.4.0" errorfunctions = "0.2.0" fftconvolve = "0.1.1" -ndarray = { version = "0.15.6", features = ["approx"] } +ndarray = { version = "0.15.6", features = ["approx", "serde"] } itertools = "0.12.0" lazy_static = "1.4.0" levenberg-marquardt = "0.13.1" nalgebra = "0.32.3" -num-complex = "0.4.3" +num-complex = { version = "0.4.3", features = ["serde"] } polyfit-rs = "0.2.1" rusty-fitpack = "0.1.1" rayon = "1.8.0" +serde = { version = "1.0.193", features = ["derive"] } +serde_arrow = { version = "0.8.0", features = ["arrow2-0-17", "arrow-46"] } [dependencies.enterpolation] diff --git a/src/main.rs b/src/main.rs index 6f278c7..73a6c9e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,11 @@ use ndarray::{array, Array1}; use xraytsubaki::xafs::mathutils::MathUtils; +use serde_arrow::{ + arrow2::{serialize_into_arrays, serialize_into_fields}, + schema::TracingOptions, +}; + fn main() -> Result<(), Box> { use xraytsubaki::xafs::io; use xraytsubaki::xafs::xafsutils::find_energy_step; @@ -19,11 +24,22 @@ fn main() -> Result<(), Box> { let k = xafs_test_group.get_k().unwrap(); let chi = xafs_test_group.get_chi().unwrap(); + // println!("k: {:?}", k); + // println!("chi: {:?}", chi); + + k.iter().zip(chi.iter()).for_each(|(k, chi)| { + println!("[{}, {}],", k, chi); + }); + + // let fields = serialize_into_fields(&xafs_test_group, TracingOptions::default())?; + + // println!("fields: {:?}", fields); + // println!("k: {:?}", k); // println!("chi: {:?}", chi); // println!("e0: {:?}", xafs_test_group.normalization.unwrap().get_e0()); - println!("{:?}", xafs_test_group); + // println!("{:?}", xafs_test_group); Ok(()) diff --git a/src/xafs/background.rs b/src/xafs/background.rs index da49814..e0a89f6 100644 --- a/src/xafs/background.rs +++ b/src/xafs/background.rs @@ -11,6 +11,7 @@ use levenberg_marquardt::{LeastSquaresProblem, LevenbergMarquardt}; use nalgebra::{DMatrix, DVector, Dyn, Owned}; use ndarray::{Array1, ArrayBase, Axis, Ix1, OwnedRepr}; use rusty_fitpack; +use serde::{Deserialize, Serialize}; // Import internal dependencies use super::lmutils::LMParameters; @@ -24,7 +25,7 @@ use super::{xafsutils, xrayfft}; /// Enum for background subtraction methods /// AUTOBK: M. Newville, P. Livins, Y. Yacoby, J. J. Rehr, and E. A. Stern. Near-edge x-ray-absorption fine structure of Pb: A comparison of theory and experiment. Phys. Rev. B, 47:14126–14131, Jun 1993. doi:10.1103/PhysRevB.47.14126. /// ILPBkg: To be implemented -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub enum BackgroundMethod { AUTOBK(AUTOBK), ILPBkg(ILPBkg), @@ -90,7 +91,7 @@ impl BackgroundMethod { /// Struct for AUTOBK /// /// Parameters and the output are stored in this struct -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct AUTOBK { /// Edge energy in eV (this is used for starting point of k). If None, it will be determined. pub ek0: Option, @@ -813,7 +814,7 @@ impl LeastSquaresProblem for AUTOBKSpline { } /// TODO: Implement ILPBkg -#[derive(Debug, Clone, PartialEq, Default)] +#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)] pub struct ILPBkg {} /// TODO: Implement ILPBkg diff --git a/src/xafs/mathutils.rs b/src/xafs/mathutils.rs index 609a942..2f4655a 100644 --- a/src/xafs/mathutils.rs +++ b/src/xafs/mathutils.rs @@ -384,15 +384,11 @@ pub fn bessel_I0(x: f64) -> f64 { /// /// pub fn splev_jacobian(t: Vec, c: Vec, k: usize, x: Vec, e: usize) -> DMatrix { - let mut y: Vec = vec![0.0; x.len()]; - let k1: usize = k + 1; let k2: usize = k1 + 1; let nk1: usize = t.len() - k1; let tb: f64 = t[k1 - 1]; let te: f64 = t[nk1]; - let mut l: usize = k1; - let mut l1: usize = l + 1; let mut derivatives: Vec> = vec![vec![0.0; c.len()]; x.len()]; diff --git a/src/xafs/normalization.rs b/src/xafs/normalization.rs index 9854c07..0a65d78 100644 --- a/src/xafs/normalization.rs +++ b/src/xafs/normalization.rs @@ -8,6 +8,7 @@ use std::error::Error; // Import external dependencies use ndarray::{Array1, ArrayBase, Ix1, OwnedRepr}; use polyfit_rs::polyfit_rs; +use serde::{Deserialize, Serialize}; // Import internal dependencies use super::mathutils::{self, MathUtils}; @@ -44,7 +45,7 @@ pub trait Normalization { /// /// let mut normalization_method = NormalizationMethod::new(); /// ``` -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub enum NormalizationMethod { PrePostEdge(PrePostEdge), MBack(MBack), @@ -167,7 +168,7 @@ impl NormalizationMethod { /// /// This is the standard normalization method used in athena and larch. /// -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct PrePostEdge { pub pre_edge_start: Option, pub pre_edge_end: Option, @@ -488,7 +489,7 @@ impl Normalization for PrePostEdge { } } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct MBack { pub e0: Option, pub edge_step: Option, diff --git a/src/xafs/xafsutils.rs b/src/xafs/xafsutils.rs index 863d27c..dc562fe 100644 --- a/src/xafs/xafsutils.rs +++ b/src/xafs/xafsutils.rs @@ -2,17 +2,25 @@ #![allow(unused_imports)] #![allow(unused_variables)] -use crate::xafs::mathutils::index_of; +// Standard library dependencies +use std::cmp; +use std::error::Error; +// External dependencies +use fftconvolve::{fftconvolve, Mode}; +use ndarray::{Array, Array1, ArrayBase, Axis, Ix1, OwnedRepr, Slice}; +use serde::{Deserialize, Serialize}; +// load dependencies use super::bessel_i0; use super::io; + +// Load local traits use super::mathutils::MathUtils; -use fftconvolve::{fftconvolve, Mode}; -use ndarray::{Array, Array1, ArrayBase, Axis, Ix1, OwnedRepr, Slice}; -use std::cmp; -use std::error::Error; +// Load local functions +use crate::xafs::mathutils::index_of; +// Constants pub const TINY_ENERGY: f64 = 0.005; /// Physical constants used in xraytsubaki @@ -481,7 +489,7 @@ pub fn _find_e0, Ix1>> + Clone>( Ok((en[imax], imax, estep)) } -#[derive(Debug, Clone, Copy, Default, PartialEq)] +#[derive(Debug, Clone, Copy, Default, PartialEq, Serialize, Deserialize)] pub enum FTWindow { #[default] Hanning, // Hanning window, cosine-squared tamper diff --git a/src/xafs/xasgroup.rs b/src/xafs/xasgroup.rs index b97c319..72430d5 100644 --- a/src/xafs/xasgroup.rs +++ b/src/xafs/xasgroup.rs @@ -8,6 +8,7 @@ use std::mem; // External dependencies use rayon::prelude::*; +use serde::{Deserialize, Serialize}; // load dependencies use super::xasspectrum; @@ -17,7 +18,7 @@ use itertools::Itertools; // Load local traits use xasspectrum::XASSpectrum; -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct XASGroup { pub spectra: Vec, } diff --git a/src/xafs/xasspectrum.rs b/src/xafs/xasspectrum.rs index 5446ef0..ab4edff 100644 --- a/src/xafs/xasspectrum.rs +++ b/src/xafs/xasspectrum.rs @@ -5,9 +5,10 @@ // Standard library dependencies use std::error::Error; -use easyfft::dyn_size::realfft::DynRealDft; // External dependencies +use easyfft::dyn_size::realfft::DynRealDft; use ndarray::{ArrayBase, Axis, Ix1, OwnedRepr}; +use serde::{Deserialize, Serialize}; // load dependencies use super::background; @@ -28,7 +29,7 @@ use normalization::Normalization; /// # Examples /// /// TODO: Add examples -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct XASSpectrum { pub name: Option, pub raw_energy: Option, Ix1>>, diff --git a/src/xafs/xrayfft.rs b/src/xafs/xrayfft.rs index 5c0e183..a95f455 100644 --- a/src/xafs/xrayfft.rs +++ b/src/xafs/xrayfft.rs @@ -1,14 +1,21 @@ +// Standard library dependencies + +// External dependencies use easyfft::prelude::{DynRealFft, DynRealIfft}; use easyfft::{dyn_size::realfft::DynRealDft, num_complex::Complex}; use nalgebra::{DVector, Owned}; use ndarray::{Array, Array1, ArrayBase, Axis, Ix, Ix1, OwnedRepr}; +use num_complex::Complex64; +use serde::{Deserialize, Serialize}; -use crate::xafs::xafsutils::FTWindow; +// load dependencies +// Load local traits use super::mathutils::MathUtils; use super::xafsutils::ftwindow; +use crate::xafs::xafsutils::FTWindow; -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct XrayFFTF { pub rmax_out: Option, pub window: Option, @@ -20,6 +27,8 @@ pub struct XrayFFTF { pub nfft: Option, pub kstep: Option, pub r: Option, Ix1>>, + // currently asking for serde support in the easyfft crate + #[serde(skip)] pub chir: Option>, pub chir_mag: Option, Ix1>>, pub kwin: Option, Ix1>>, @@ -209,7 +218,7 @@ impl XrayFFTF { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct XrayFFTR { pub qmax_out: Option, pub window: Option, @@ -564,6 +573,25 @@ impl FFTUtils> for [Complex] { } } +// #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +// pub struct DynRealDftWrapper { +// zeroth_bin: f64, + +// frequency_bins: Vec>, + +// original_length: usize, +// } + +// impl From> for DynRealDftWrapper { +// fn from(dft: DynRealDft) -> Self { +// DynRealDftWrapper { +// zeroth_bin: dft.get_offset().clone(), +// frequency_bins: dft.get_frequency_bins().to_vec(), +// original_length: dft.get_original_length(), +// } +// } +// } + // impl PartialEq for DynRealDft { // fn eq(&self, other: &Self) -> bool { // self.len() == other.len()