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

Adds feature "plot current sheet" #143

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

wzq215
Copy link

@wzq215 wzq215 commented Sep 15, 2023

PR Description

Adds feature 'plot_current_sheet.' (#53)
Extracts the current sheet (isosurface where Br=0) from pfsspy output by pyvista.

current_sheet.py is an example script that plots the current sheet, gong map, and field lines together.

@TrestanSimon
Copy link
Contributor

pre-commit.ci autofix

@TrestanSimon
Copy link
Contributor

TrestanSimon commented Sep 25, 2023

pre-commit.ci autofix

@wzq215 I do not have write access to your fork so I do not think I can request an autofix; but if you comment pre-commit.ci autofix on this PR, it should automatically fix the issues causing the pre-commit.ci check to fail. (Or you can run pre-commit locally and commit the fixes.)

@wzq215
Copy link
Author

wzq215 commented Sep 27, 2023

pre-commit.ci autofix

@TrestanSimon
Copy link
Contributor

We might also want to add some tests for plot_current_sheet. Maybe something like test_field_lines_figure.

@wzq215
Copy link
Author

wzq215 commented Oct 3, 2023

Hi, I wrote a test (test current sheet) but fail to run any tests in the script... The error message is:

ERROR: usage: _jb_pytest_runner.py [options] [file_or_dir] [file_or_dir] [...]
_jb_pytest_runner.py: error: unrecognized arguments: --doctest-rst
 inifile: /Users/ephe/codes/sunkit-pyvista/setup.cfg
 rootdir: /Users/ephe/codes/sunkit-pyvista

@wzq215
Copy link
Author

wzq215 commented Oct 3, 2023

pre-commit.ci autofix

1 similar comment
@wzq215
Copy link
Author

wzq215 commented Oct 3, 2023

pre-commit.ci autofix

@TrestanSimon
Copy link
Contributor

Hi, I wrote a test (test current sheet) but fail to run any tests in the script... The error message is:

ERROR: usage: _jb_pytest_runner.py [options] [file_or_dir] [file_or_dir] [...]
_jb_pytest_runner.py: error: unrecognized arguments: --doctest-rst
 inifile: /Users/ephe/codes/sunkit-pyvista/setup.cfg
 rootdir: /Users/ephe/codes/sunkit-pyvista

@wzq215 To run tests locally you may need to download some or all of the extra dependencies in setup.cfg:

[options.extras_require]
tests =
  pytest
  pytest-cov
  pytest-doctestplus
  scikit-image
docs =
  ipython
  sphinx
  sphinx-automodapi
  sphinx-changelog
  sphinx-gallery
  streamtracer
  sunpy-sphinx-theme

@nabobalis
Copy link
Contributor

I pushed an update that fixes the main CI failure and tweaks the image generation flags needed for pytest. You will have to either merge in upstream/main or press the update branch button at the bottom of the pull request (I assume anyone with write access can see it).

@@ -509,6 +510,31 @@ def color_func(field_line):

self._add_mesh_to_dict(block_name="field_lines", mesh=spline)

def plot_current_sheet(self, pfss_out, **kwargs):
"""
Plot current sheet "(Br=0)".
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the definition of a current sheet in a PFSS model?

Copy link
Member

@Cadair Cadair left a comment

Choose a reason for hiding this comment

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

Hi @wzq215

We have recently forked pfsspy and made sunkit-magex so I am looking over related things again. Is this PR something you are interested in coming back to, or would you like me to adopt it?

**kwargs :
Keyword arguments are passed to `pyvista.Plotter.add_mesh`.
"""
sc_vect = pfss_out.grid.sc
Copy link
Member

Choose a reason for hiding this comment

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

Is the way we are loading the output here the same as in #72?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure but it should be looked at. I would hope we can that code instead.

If we can expand the code in 72 to work for all frames and return all the surfaces, we can then change this to plot a surface based on user input.

@nabobalis nabobalis added this to the 0.4.0 milestone Jun 18, 2024
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.

4 participants