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

Refactoring plasmapy.dispersion structure #1208

Merged
merged 92 commits into from
Aug 14, 2021

Conversation

Sjbrownian
Copy link
Contributor

@Sjbrownian Sjbrownian commented Jul 24, 2021

This PR refactors the plasmapy.dispersion structure ...

  1. create sub-package plasmapy.dispersion.analytical
  2. create sub-package plasmapy.dispersion.numerical
  3. move and rename plasmapy.dispersion.two_fluid_dispersion -> plasmapy.dispersion.analytical.two_fluid
  4. renamed two_fluid_dispersion_solution -> two_fluid
  5. updated supporting documentation and testing materials.

@codecov
Copy link

codecov bot commented Aug 7, 2021

Codecov Report

❗ No coverage uploaded for pull request base (main@84c6f32). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1208   +/-   ##
=======================================
  Coverage        ?   96.99%           
=======================================
  Files           ?       73           
  Lines           ?     7053           
  Branches        ?        0           
=======================================
  Hits            ?     6841           
  Misses          ?      212           
  Partials        ?        0           

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 84c6f32...51d1f94. Read the comment docs.

Comment on lines 1 to 4
Reorganization of `~plasmapy.dispersion.two_fluid_dispersion_solution`,
The analytical solution file has been moved to a new folder inside
PlasmaP/plasmapy/dispersion/ called `analytical` and the file it self has been
renamed from two_fluid_dispersion_solution.py to two_fluid.py
Copy link
Member

Choose a reason for hiding this comment

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

break this into two change logs

1208.feature.rst

Restructuring of the `plasmapy.dispersion` subpackage by creating the
`~plasmapy.dispersion.analytical` subpackage to contain functionality
related to analytical dispersion solutions.

1208.breaking.rst

Renamed file ``two_fluid_dispersion.py`` to ``two_fluid.py`` and moved into
the ``plasmapy.dispersion.analytical`` subpackage.  The contained function
``two_fluid_dispersion_solutions()`` was also renamed to
`~plasmapy.dispersion.analytical.two_fluid.two_fluid`.

@@ -1,4 +1,8 @@
__all__ = ["two_fluid_dispersion_solution"]
"""
Copy link
Member

Choose a reason for hiding this comment

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

So we have a bit of a naming conflict between two_fluid the file and two_fluid the function. This currently doesn't cause major issues but will lead to unexpected behavior for documentation and importing. With the current code, two_fluid the file could never be imported because two_fluid is always overwritten as the function by

from plasmapy.dispersion.analytical.two_fluid import two_fluid

in plasmapy/dispersion/analytical/__init__.py. My proposed solution is to rename two_fluid.py to two_fluid_.py. In python the trailing underscore is often used to avoid naming conflicts when reasonable differing names can't be created for similar objects.

Copy link
Member

@rocco8773 rocco8773 left a comment

Choose a reason for hiding this comment

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

Can you add a module level docstring to dispersionfunction.py? The top of the file should look something like...

"""
Module containing functionality focused on the plasma dispersion function
:math:`Z(ζ)`.
"""
__all__ = ["plasma_dispersion_func", "plasma_dispersion_func_deriv"]

import astropy.units as u
import numbers
import numpy as np

...

If you do this and..

  1. break up the change log entries like we discussed during office hours
  2. resolve the two_fluid naming conflict (i.e. two_fluid.py -> two_fluid_.py)

then we can merge.

@Sjbrownian
Copy link
Contributor Author

Can you add a module level docstring to dispersionfunction.py? The top of the file should look something like...

"""
Module containing functionality focused on the plasma dispersion function
:math:`Z(ζ)`.
"""
__all__ = ["plasma_dispersion_func", "plasma_dispersion_func_deriv"]

import astropy.units as u
import numbers
import numpy as np

...

If you do this and..

  1. break up the change log entries like we discussed during office hours
  2. resolve the two_fluid naming conflict (i.e. two_fluid.py -> two_fluid_.py)

then we can merge.

I've made these changes and all the checks passed (except the numpy and xarray checks we discussed last week).

Copy link
Member

@rocco8773 rocco8773 left a comment

Choose a reason for hiding this comment

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

Alright, this looks good! Thank you for sticking with this. As soon as all the checks pass I'll merge it. Congrats on your first successful PR!!! 🎉

@rocco8773 rocco8773 merged commit 5949953 into PlasmaPy:main Aug 14, 2021
@rocco8773 rocco8773 mentioned this pull request Aug 16, 2021
3 tasks
Tlord18 pushed a commit to Tlord18/PlasmaPy that referenced this pull request Oct 6, 2021
Tlord18 pushed a commit to Tlord18/PlasmaPy that referenced this pull request Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notebooks Related to example Jupyter notebooks in docs/examples/ plasmapy.dispersion Related to the plasmapy.dispersion subpackage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants