AFM-SPM / TopoStats

An AFM image analysis program to batch process data and obtain statistics from images
https://afm-spm.github.io/TopoStats/
GNU Lesser General Public License v3.0
57 stars 10 forks source link

Split config file into advanced and basic setting #542

Open derollins opened 1 year ago

derollins commented 1 year ago

Is your feature request related to a problem? Please describe. Aid usability by splitting 'basic' functional settings and 'advanced' parameters.

Describe the solution you'd like

Here is my idea:

#Basic

base_dir: C:\Users\Work\OneDrive\Documents\Uni\Research\Data\My_Data\20230426_Sixfold
output_dir: C:\Users\Work\OneDrive\Documents\Uni\Research\Data\My_Data\20230426_Sixfold\output

file_ext: .spm
loading:
  channel: Height
filter:
  run: true
grains:
  run: true
grainstats:
  run: true

plotting:
  run: true
  save_format: png
  image_set: core
  zrange:
  - -4
  - 4
  colorbar: true
  axes: true
  cmap: nanoscope
summary_stats:
  run: true

---------------------------------------------------------------------------------------------------

#Advanced 

log_level: info
cores: 3
filter:
  row_alignment_quantile: 0.2
  threshold_method: std_dev
  otsu_threshold_multiplier: 1.0
  threshold_std_dev:
    below: 10.0
    above: 1.0
  threshold_absolute:
    below: -1.0
    above: 1.0
  gaussian_size: 1.0121397464510862
  gaussian_mode: nearest
  remove_scars:
    run: true
    removal_iterations: 2
    threshold_low: 0.25
    threshold_high: 0.666
    max_scar_width: 4
    min_scar_length: 16
grains:
  threshold_method: std_dev
  otsu_threshold_multiplier: 1.0
  threshold_std_dev:
    below: 10.0
    above: 1.0
  threshold_absolute:
    below: -1.0
    above: 1.0
  direction: above
  smallest_grain_size_nm2: 50
  absolute_area_threshold:
    above:
    - 300
    - 3000
    below:
    - 
    - 
grainstats:
  edge_detection_method: binary_erosion
  cropped_size: 40.0
dnatracing:
  run: true
plotting:
  mask_cmap: blu
  histogram_log_axis: false
  histogram_bins: 200
  dpi: 1000
summary_stats:
  config:

Additional context Discussed at Pyne group meeting 27/04/2023

ns-rse commented 1 year ago

You can't structure a YAML file in that manner as it introduces duplicate key names, e.g. there are now two filter sections. Its why the configuration options that pertain to a step in processing are nested under that processes section.

SylviaWhittle commented 1 year ago

We could structure it as...

basic:
  base_dir: C:\Users\Work\OneDrive\Documents\Uni\Research\Data\My_Data\20230426_Sixfold
  output_dir: C:\Users\Work\OneDrive\Documents\Uni\Research\Data\My_Data\20230426_Sixfold\output
  file_ext: .spm
  loading:
    channel: Height
  filter:
    run: true
  grains:
    run: true
  grainstats:
    run: true

  plotting:
    run: true
    save_format: png
    image_set: core
    zrange:
    - -4
    - 4
    colorbar: true
    axes: true
    cmap: nanoscope
  summary_stats:
    run: true

---------------------------------------------------------------------------------------------------

advanced:  
  log_level: info
  cores: 3
  filter:
    row_alignment_quantile: 0.2
    threshold_method: std_dev
    otsu_threshold_multiplier: 1.0
    threshold_std_dev:
      below: 10.0
      above: 1.0
    threshold_absolute:
      below: -1.0
      above: 1.0
    gaussian_size: 1.0121397464510862
    gaussian_mode: nearest
    remove_scars:
      run: true
      removal_iterations: 2
      threshold_low: 0.25
      threshold_high: 0.666
      max_scar_width: 4
      min_scar_length: 16
  grains:
    threshold_method: std_dev
    otsu_threshold_multiplier: 1.0
    threshold_std_dev:
      below: 10.0
      above: 1.0
    threshold_absolute:
      below: -1.0
      above: 1.0
    direction: above
    smallest_grain_size_nm2: 50
    absolute_area_threshold:
      above:
      - 300
      - 3000
      below:
      - 
      - 
  grainstats:
    edge_detection_method: binary_erosion
    cropped_size: 40.0
  dnatracing:
    run: true
  plotting:
    mask_cmap: blu
    histogram_log_axis: false
    histogram_bins: 200
    dpi: 1000
  summary_stats:
    config:

And then combine all sections together again before config validation? It's a popular feature request by users.