AstarVienna / ScopeSim_Templates

GNU General Public License v3.0
2 stars 4 forks source link

Linting, refactoring and other improvements #53

Closed teutoburg closed 1 year ago

teutoburg commented 1 year ago

Listen to Pylint, also docstring formatting and refining, some improvements to astropy units usage (less ìsinstance), remove some duplicate checks and conversions.

Some general refactoring like extracting duplicate code parts (of which there were a bunch!), de-nesting, using generator, et cetera.

Improving the "add function call to meta" decorator and functions, which now actually works I think.

Fixing a bug reported by a user about redshift and magnitude scaling not passed in the galaxies.galaxy function.

Adding some tests and updating others, fix a warning or two.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 83.15% and project coverage change: +0.53% :tada:

Comparison is base (e5cef1f) 77.97% compared to head (dddbf4d) 78.50%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev_master #53 +/- ## ============================================== + Coverage 77.97% 78.50% +0.53% ============================================== Files 42 42 Lines 2007 1945 -62 ============================================== - Hits 1565 1527 -38 + Misses 442 418 -24 ``` | [Files Changed](https://app.codecov.io/gh/AstarVienna/ScopeSim_Templates/pull/53?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AstarVienna) | Coverage Δ | | |---|---|---| | [scopesim\_templates/\_\_init\_\_.py](https://app.codecov.io/gh/AstarVienna/ScopeSim_Templates/pull/53?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AstarVienna#diff-c2NvcGVzaW1fdGVtcGxhdGVzL19faW5pdF9fLnB5) | `100.00% <ø> (ø)` | | | [scopesim\_templates/utils/samplers.py](https://app.codecov.io/gh/AstarVienna/ScopeSim_Templates/pull/53?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AstarVienna#diff-c2NvcGVzaW1fdGVtcGxhdGVzL3V0aWxzL3NhbXBsZXJzLnB5) | `11.90% <0.00%> (ø)` | | | [scopesim\_templates/calibration/calibration.py](https://app.codecov.io/gh/AstarVienna/ScopeSim_Templates/pull/53?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AstarVienna#diff-c2NvcGVzaW1fdGVtcGxhdGVzL2NhbGlicmF0aW9uL2NhbGlicmF0aW9uLnB5) | `58.62% <44.44%> (+17.59%)` | :arrow_up: | | [scopesim\_templates/stellar/imf.py](https://app.codecov.io/gh/AstarVienna/ScopeSim_Templates/pull/53?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AstarVienna#diff-c2NvcGVzaW1fdGVtcGxhdGVzL3N0ZWxsYXIvaW1mLnB5) | `47.71% <51.06%> (+0.60%)` | :arrow_up: | | [scopesim\_templates/misc/misc.py](https://app.codecov.io/gh/AstarVienna/ScopeSim_Templates/pull/53?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AstarVienna#diff-c2NvcGVzaW1fdGVtcGxhdGVzL21pc2MvbWlzYy5weQ==) | `68.78% <76.36%> (-0.49%)` | :arrow_down: | | [scopesim\_templates/extragalactic/exgal\_models.py](https://app.codecov.io/gh/AstarVienna/ScopeSim_Templates/pull/53?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AstarVienna#diff-c2NvcGVzaW1fdGVtcGxhdGVzL2V4dHJhZ2FsYWN0aWMvZXhnYWxfbW9kZWxzLnB5) | `91.59% <85.18%> (ø)` | | | [scopesim\_templates/stellar/stars.py](https://app.codecov.io/gh/AstarVienna/ScopeSim_Templates/pull/53?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AstarVienna#diff-c2NvcGVzaW1fdGVtcGxhdGVzL3N0ZWxsYXIvc3RhcnMucHk=) | `97.40% <90.00%> (-0.25%)` | :arrow_down: | | [scopesim\_templates/extragalactic/galaxies.py](https://app.codecov.io/gh/AstarVienna/ScopeSim_Templates/pull/53?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AstarVienna#diff-c2NvcGVzaW1fdGVtcGxhdGVzL2V4dHJhZ2FsYWN0aWMvZ2FsYXhpZXMucHk=) | `93.84% <93.05%> (-1.73%)` | :arrow_down: | | [scopesim\_templates/utils/general\_utils.py](https://app.codecov.io/gh/AstarVienna/ScopeSim_Templates/pull/53?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AstarVienna#diff-c2NvcGVzaW1fdGVtcGxhdGVzL3V0aWxzL2dlbmVyYWxfdXRpbHMucHk=) | `91.04% <96.42%> (+3.28%)` | :arrow_up: | | [scopesim\_templates/extragalactic/galaxy\_utils.py](https://app.codecov.io/gh/AstarVienna/ScopeSim_Templates/pull/53?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AstarVienna#diff-c2NvcGVzaW1fdGVtcGxhdGVzL2V4dHJhZ2FsYWN0aWMvZ2FsYXh5X3V0aWxzLnB5) | `93.33% <100.00%> (ø)` | | | ... and [9 more](https://app.codecov.io/gh/AstarVienna/ScopeSim_Templates/pull/53?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AstarVienna) | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

hugobuddel commented 1 year ago

Merge? (I'm not pressing that button at 21:00 on a Friday night.)

teutoburg commented 1 year ago

Other people pay money to watch things go up in flames on a Friday night 😛