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

Collate random seed setting #2978

Merged
merged 2 commits into from
Jan 31, 2024
Merged

Conversation

athoynilimanew
Copy link
Contributor

@athoynilimanew athoynilimanew commented Jan 31, 2024

Linked Issues

Closes #2960

Description

Collate random seed setting: sets the random number seed so our results in some cases are reproduceable.

Added the class RNGSeeds in bluemira/base/constants.py.

It sets random seeds to be used in functions that depend on random number generations:

  • collocation_points() in bluemira.equilibria.harmonics,

  • generate_lognorm_distribution(), generate_truncnorm_distribution(), and generate_exponential_distribution() in bluemira.fuel_cycle.timeline_tools,

and

  • calculate_outages() in bluemira.fuel_cycle.timeline

In case you add new functionalities in Bluemira in future that would depend on random number generations, it will be suggested to put a corresponding random seed in the RNGSeeds class too.

Interface Changes

Checklist

I confirm that I have completed the following checks:

  • Tests run locally and pass pytest tests --reactor
  • Code quality checks run locally and pass pre-commit run --from-ref develop --to-ref HEAD
  • Documentation built locally and checked sphinx-build -W documentation/source documentation/build

@athoynilimanew athoynilimanew requested review from a team as code owners January 31, 2024 12:31
@athoynilimanew athoynilimanew force-pushed the anilima/2960-collate-random-seed-setting branch from ddcfc03 to f01f07e Compare January 31, 2024 12:44
Copy link

sonarcloud bot commented Jan 31, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@athoynilimanew athoynilimanew added the 📜 Papercut Papercut bug label Jan 31, 2024
Copy link

codecov bot commented Jan 31, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (51c7fdf) 79.79% compared to head (c82020e) 79.81%.

Files Patch % Lines
bluemira/fuel_cycle/timeline.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2978      +/-   ##
===========================================
+ Coverage    79.79%   79.81%   +0.01%     
===========================================
  Files          226      226              
  Lines        25044    25052       +8     
===========================================
+ Hits         19985    19994       +9     
+ Misses        5059     5058       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@athoynilimanew
Copy link
Contributor Author

tests/equilibria/test_optimisation.py Fails (both in develop and this branch. This branch was rebased w.r.t develop)

Copy link
Contributor

⚠️ Warning Report

Found 0 new warnings, 0 fixed warnings. 🎉

All warnings (15)

On collect

  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.utilities.opt_problems' is deprecated and will be removed in v2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.equilibria.opt_problems' is deprecated and will be removed in v2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.equilibria.opt_constraint_funcs' is deprecated and will be removed in v2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/pkg_resources/__init__.py:2868: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('sphinxcontrib'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.utilities.optimiser' is deprecated and will be removed in version 2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/pkg_resources/__init__.py:2868: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('mpl_toolkits'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.equilibria.opt_objectives' is deprecated and will be removed in v2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.utilities.opt_tools' is deprecated and will be removed in v2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.geometry.optimisation._optimisation_old' is deprecated and will be removed in v2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/shiboken2/files.dir/shibokensupport/feature.py:139: DeprecationWarning: The module 'bluemira.equilibria.opt_constraints' is deprecated and will be removed in v2.0.0. See https://bluemira.readthedocs.io/en/latest/optimisation/optimisation.html for documentation of the new optimisation module.

On runtest

  • /home/runner/work/bluemira/bluemira/bluemira/base/reactor.py:676: DeprecationWarning: Using kwarg 'dim' is no longer supported. Simply pass in the dimensions you would like to show, e.g. show_cad('xz')
  • /home/runner/miniconda3/envs/bluemira/lib/python3.8/site-packages/h5py/__init__.py:36: UserWarning: h5py is running against HDF5 1.14.3 when it was built against 1.14.2, this may cause problems
  • /home/runner/work/bluemira/bluemira/tests/builders/test_tf_coils.py:46: DeprecationWarning: RippleConstrainedLengthGOP API has changed, please specify how you want to constrain TF ripple by using one of the available RipplePointSelector classes. Defaulting to an EquispacedSelector with n_rip_points=3 for now.
  • /home/runner/work/bluemira/bluemira/eudemo/eudemo/tf_coils/tf_coils.py:338: DeprecationWarning: Argument 'separatrix' is deprecated, argument 'ripple_wire' is used instead.

@athoynilimanew athoynilimanew changed the title 🔐 WIP: Collate random seed setting 🔐 Collate random seed setting Jan 31, 2024
@athoynilimanew athoynilimanew changed the title 🔐 Collate random seed setting Collate random seed setting Jan 31, 2024
Copy link
Contributor

@je-cook je-cook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me thanks very much. That test isn't failing for me or the CI so maybe its something in your setup?

@je-cook je-cook merged commit 03b0aaa into develop Jan 31, 2024
4 checks passed
@je-cook je-cook deleted the anilima/2960-collate-random-seed-setting branch January 31, 2024 13:38
OceanNuclear pushed a commit that referenced this pull request Feb 20, 2024
* 🔐 Collate random seed setting

* ✅ Add random seed from RNGSeeds class to the function in collocation_points()

---------

Co-authored-by: Athoy Nilima <athoy.nilima@ukaea.uk>
OceanNuclear pushed a commit that referenced this pull request Jun 17, 2024
* 🔐 Collate random seed setting

* ✅ Add random seed from RNGSeeds class to the function in collocation_points()

---------

Co-authored-by: Athoy Nilima <athoy.nilima@ukaea.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📜 Papercut Papercut bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collate random seed setting
2 participants