DeltaRCM / pyDeltaRCM

Delta model with a reduced-complexity approach
https://deltarcm.org/pyDeltaRCM/
MIT License
18 stars 11 forks source link

Documentation: examples and a few warnings during instantiation in the code #252

Closed amoodie closed 2 years ago

amoodie commented 2 years ago

Code base

This PR adds warnings during instantiation for any unused keyword arguments, and a special warning for any preprocessor-only keyword arguments (e.g., #248). So now, passing e.g. set to the DeltaModel will raise the warning:

warnings.warn(UserWarning(
  'A Preprocessor-only keyword was specified as input in '
  'yaml file or kwargs: {0}. Advanced configurations '
  'are only supported by the Preprocessor via the '
  'high-level API. Any parameters specified as part of this '
  'advanced keyword configuration will not be used!'.format(
      any_in_preprocessor)))

Any other keyword that is not interpreted by the DeltaModel will raise a warning:

warnings.warn(UserWarning(
  'One or more inputs in yaml file or kwargs were unused by '
  'the model during instantiation. '
  'The unused keys are: {0}'.format(str(unused_user_keys))))

documentation

This PR adds several examples to the documentation.

The first file demonstrates how to use checkpointing. Three examples are included in that file (i) resume from a file by passing the folder location as out_dir and resume_checkpoint=True, (ii) resume from file by path to folder with checkpoint resume_checkpoint='path/to/folder', and (iii) specifying the path to resume from checkpoint to the preprocessor to create a batch of new jobs to run with different parameters from that checkpoint.

The second file includes an example for how to use custom classes with the Preprocessor to run a batch of jobs.

codecov[bot] commented 2 years ago

Codecov Report

Merging #252 (bb10190) into develop (95a752f) will increase coverage by 0.07%. The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop     #252      +/-   ##
===========================================
+ Coverage    78.99%   79.06%   +0.07%     
===========================================
  Files           12       12              
  Lines         2599     2608       +9     
===========================================
+ Hits          2053     2062       +9     
  Misses         546      546              
Impacted Files Coverage Δ
pyDeltaRCM/init_tools.py 97.15% <100.00%> (+0.04%) :arrow_up:
pyDeltaRCM/preprocessor.py 84.13% <100.00%> (+0.11%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 95a752f...bb10190. Read the comment docs.