Are we science yet? `Validate`, a create for validating scientific computations

Hi all,

My name is Germán Molina and I am not really a computer scientists but more like a scientist. I use Rust to solve relatively big mathematical problems (and not so much with GUIs and Asyncs and other stuff).

(So, I guess a first item in this post is: who else is in this position? I'd like to talk, as I think Rust is very helpful for this (because I can focus on the damn math instead of in the number of potential problems that I did not even know existed until I tried to do something with C and everything was a mess).)

Long story short, I have been developing a Building Performance Simulation tool for some time and I have seen the need for having some validations embedded in my unit/integration testing. For this I developed Validate, a crate that helps compare the results of a computation with results from a different source (e.g., measured, calculated by another tool, etc.).

The idea is that this crate can be used to build an automatic report that will be built through CI and stored in SIMPLE's Repositories, allowing for full transparency and letting people see how accurate the results are.

This is in VERY early stages (1 actual commit and then a bunch of small commits related to CI and badges and formatting of the readme) so if you want to contribute or have something to say, this might be the best time.

Best!

4 Likes

PD: HERE is a very basic example of this

I will like to contribute

1 Like

Please do. I have some ideas! Just create issues and we can discuss there.

Okay. I will

Update log:

I have just introduced an Attribute Macro that allows enriching test reports with docs.

/// This test serves as an example of how to use the Validation crate.
/// 
/// You can add explanation using `Markdown`, and these will be translated into
/// the `HTML` report.
#[valid(Time Series Test)]
fn time_series_test()->Box<dyn Validate>{
    let expected = vec![1., 2., 3.];
    let found = vec![5., 6., 6.];
    let v = SeriesValidator {
        x_label: Some("time step".into()),
        y_label: Some("Zone Temperature".into()),
        y_units: Some("C"),        
        expected,
        found,
        ..validate::SeriesValidator::default()
    };

    Box::new(v)
}

// Write a test
#[test]
fn test_series_validator() {
    let mut validator = Validator::new("Validate Time series", "report.html");
    
    let v = time_series_test();    
    validator.push(v);

    // This will not fail because we did not set a maximum allowed
    // Root Mean Square Error or Mean Bias Error... if we did, it would return
    // an error and the unwrap woul
    validator.validate().unwrap();
}
1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.