Function deserialize_array_with_metadata

Source
pub fn deserialize_array_with_metadata<P, A>(
    path: P,
    format: SerializationFormat,
) -> Result<(Array<A, IxDyn>, HashMap<String, String>)>
where P: AsRef<Path>, A: for<'de> Deserialize<'de> + Clone,
Expand description

Deserialize an ndarray with metadata from a file

§Arguments

  • path - Path to the input file
  • format - Serialization format

§Returns

  • Result<(Array<A, IxDyn>, std::collections::HashMap<String, String>)> - Deserialized array and metadata

§Examples

use ndarray::Array2;
use scirs2_io::serialize::{deserialize_array_with_metadata, SerializationFormat};

// Deserialize array with metadata
let (array, metadata) = deserialize_array_with_metadata::<_, f64>(
    "data_with_metadata.json",
    SerializationFormat::JSON
).unwrap();

println!("Deserialized array shape: {:?}", array.shape());
println!("Metadata: {:?}", metadata);