Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azs - several formatting updates and refactoring & a bugfix in water autopop #44

Merged
merged 24 commits into from
May 7, 2024

Conversation

zsarnoczay
Copy link
Collaborator

No description provided.

ioannis-vm and others added 24 commits April 8, 2024 05:43
The code is currently a bit messy and by no means final.
That's what feature branches are for, I guess.
Storing it here on this branch to eliminate the need of keeping it in
a stash and risk accidentally purging it.
- Finalizes create_Hazus_HU_fragility_db.
- Introduces a .json file with predefined metadata
- Added code is linted and type-hinted.
It's simpler to just use the `sample` attribute directly here.
In an effort to modularize the loss model, sample_size is turned into
an argument that has to be passed in `calculate` instead of having to
infer it from other assessment models. This small change evolved into
a larger refactoring effort to make sampling_size more explicit across
methods.

- The config schema was modified to include sampling information as
part of "Options".
- `sampling_size` is included in all `calcualte` methods as an
explicit argument and no longer has to be infered with `self._samnt.`
- Test suite updated

DL_calculation is modified to assign sample_size when calling
`.calculate` methods. Also:
- The `config` dictionary is used explictly instead of assigning
sub-dictionaries into variables. This helps understand the full path
to the retrieved item at any point in the code, instead of having to
remember what key corresponds to what variable.
- Improved some parts where there was strange syntax like
  `if out_config.get('Demand', None) is not None` ->
  `if 'Demand' is in out_config`
- Don't need a second method for the deprecation warning.
  I'm not sure why I thought we do.
- Update .gitignore
We can always place them back when we need to use them.
`_` is commonly used for representing unused variables and makes our
linters happy.
Remove unused argument (PGB) from
`DamageModel._prepare_dmg_quantities`
If there is no sample `aggregate_losses` returns None.
Aggregating losses without a repair sample is unusual and we need to
rethink what should be done in that case instad of returning None,
which is a bit unintuitive and turns the output type of the method to
optional, making things more complicated.
Addresses most pylint warnings after having enabled
`pylint.extensions.docparams`. Left a few relating to empty property
methods that are about to be removed.
@zsarnoczay zsarnoczay merged commit bab6c24 into NHERI-SimCenter:master May 7, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants