Skip to content

Commit

Permalink
Merge pull request #20 from MFraters/change_last_LPOs_to_CPOs
Browse files Browse the repository at this point in the history
Change last LPO's to CPO's.
  • Loading branch information
MFraters authored Oct 18, 2022
2 parents 2e08386 + 3492d86 commit 54052e1
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
10 changes: 5 additions & 5 deletions examples/example_experiment_1/statistics
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# timestep_size time particle_LPO
0.5 0 particle_LPO
0.5 0.5 particle_LPO
0.5 1.0 particle_LPO
0.5 1.5 particle_LPO
# timestep_size time particle_CPO
0.5 0 particle_CPO
0.5 0.5 particle_CPO
0.5 1.0 particle_CPO
0.5 1.5 particle_CPO
4 changes: 2 additions & 2 deletions src/configuration/pole_figure_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub struct PoleFiguresConfiguration {

/// Optional value of the prefix where to write out the produced pole figures. The program will add a postfix containing
/// informatio about individual variables and settings such as the timestep and axes, etc.
/// The default value is `weighted_LPO`.
/// The default value is `weighted_CPO`.
#[serde(default = "figure_output_prefix")]
pub figure_output_prefix: String,

Expand Down Expand Up @@ -111,7 +111,7 @@ impl Default for PoleFiguresConfiguration {
particle_data_file_prefix: "particle_CPO/particles".to_string(),
grain_data_file_prefix: "particle_CPO/weighted_CPO".to_string(),
figure_output_dir: "CPO_figures/".to_string(),
figure_output_prefix: "weighted_LPO".to_string(),
figure_output_prefix: "weighted_CPO".to_string(),
color_scale: ColorGradient::Batlow,
elastisity_header: true,
small_figure: false,
Expand Down
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

//! # CPO analyzer
//!
//! This crate contains tools to analyzer Crystal/Lattice Preffered Orientation (CPO/LPO) data. It is currently
//! This crate contains tools to analyzer Crystal/Lattice Preffered Orientation (CPO/CPO) data. It is currently
//! only able to crate sets of polefigures from ASPECT CPO data, but other type of inputs and plots of analysis
//! are in the scope of this crate.
//!
Expand Down Expand Up @@ -213,11 +213,11 @@ pub fn process_configuration(config: Config) -> Result<(), Box<dyn std::error::E
experiment_dirs.par_iter().for_each(|experiment_dir| {
println!("Processing experiment {}", experiment_dir);

let lpo_dir = base_dir.clone() + &experiment_dir;
let cpo_dir = base_dir.clone() + &experiment_dir;

// get a vector with the time for all the timesteps
let statistics_file =
lpo_dir.to_owned() + &config.pole_figures.as_ref().unwrap().time_data_file;
cpo_dir.to_owned() + &config.pole_figures.as_ref().unwrap().time_data_file;

println!("time data file:{}", statistics_file);
let file = File::open(statistics_file).unwrap();
Expand All @@ -233,7 +233,7 @@ pub fn process_configuration(config: Config) -> Result<(), Box<dyn std::error::E
}

if line.find('#') != Some(0) {
if line.find("particle_LPO") != None {
if line.find("particle_CPO") != None {
data = data + &line + "\n";
}
}
Expand Down Expand Up @@ -296,7 +296,7 @@ pub fn process_configuration(config: Config) -> Result<(), Box<dyn std::error::E
);

fs::create_dir_all(
lpo_dir.to_owned() + &pole_figure_configuration.figure_output_dir,
cpo_dir.to_owned() + &pole_figure_configuration.figure_output_dir,
)
.unwrap();

Expand Down Expand Up @@ -326,7 +326,7 @@ pub fn process_configuration(config: Config) -> Result<(), Box<dyn std::error::E
while !file_found {
let angles_file = format!(
"{}{}-{:05}.{:04}.dat",
lpo_dir,
cpo_dir,
pole_figure_configuration.grain_data_file_prefix,
time_step,
rank_id
Expand Down Expand Up @@ -370,7 +370,7 @@ pub fn process_configuration(config: Config) -> Result<(), Box<dyn std::error::E

let output_file = format!(
"{}{}_{}{}{}{}_g{}_sp{}_t{:05}.{:05}.png",
lpo_dir,
cpo_dir,
file_prefix_figures,
if elastisity_header {
"elastic_"
Expand All @@ -388,7 +388,7 @@ pub fn process_configuration(config: Config) -> Result<(), Box<dyn std::error::E
let output_file = Path::new(&output_file);
let particle_file = format!(
"{}{}-{:05}.{:04}.dat",
lpo_dir,
cpo_dir,
pole_figure_configuration.particle_data_file_prefix,
time_step,
rank_id
Expand Down
16 changes: 8 additions & 8 deletions tests/run_test_example_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ fn test_library_run() -> Result<(), Box<dyn std::error::Error>> {
let cmd = Command::new("compare")
.arg("-metric")
.arg("AE")
.arg("examples/example_experiment_1/CPO_figures/weighted_LPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("examples/example_experiment_1/CPO_figures/weighted_LPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("examples/example_experiment_1/CPO_figures/weighted_CPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("examples/example_experiment_1/CPO_figures/weighted_CPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("null")
.ok();
if cmd.is_ok() {
Command::new("compare")
.arg("-metric")
.arg("AE")
.arg("examples/example_experiment_1/CPO_figures/weighted_LPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("examples/example_experiment_1/test_results_binary/weighted_LPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("examples/example_experiment_1/CPO_figures/weighted_CPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("examples/example_experiment_1/test_results_binary/weighted_CPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("null")
.assert()
.success();
Expand All @@ -72,16 +72,16 @@ fn test_binary() -> Result<(), Box<dyn std::error::Error>> {
let cmd = Command::new("compare")
.arg("-metric")
.arg("AE")
.arg("examples/example_experiment_1/CPO_figures/weighted_LPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("examples/example_experiment_1/CPO_figures/weighted_LPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("examples/example_experiment_1/CPO_figures/weighted_CPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("examples/example_experiment_1/CPO_figures/weighted_CPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("null")
.ok();
if cmd.is_ok() {
Command::new("compare")
.arg("-metric")
.arg("AE")
.arg("examples/example_experiment_1/CPO_figures/weighted_LPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("examples/example_experiment_1/test_results_binary/weighted_LPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("examples/example_experiment_1/CPO_figures/weighted_CPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("examples/example_experiment_1/test_results_binary/weighted_CPO_elastic_oli_ens_A-B-C-Axis_Batlow_g1_sp301_t00001.00000.png")
.arg("null")
.assert()
.success();
Expand Down

0 comments on commit 54052e1

Please sign in to comment.