Skip to content

Added solution plot function #16

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

Closed
wants to merge 5 commits into from

Conversation

anushkasinghh
Copy link

No description provided.

@anushkasinghh
Copy link
Author

@yguclu please review this pr :)

Comment on lines +375 to +393
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},

Choose a reason for hiding this comment

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

It seems to me that this metadata can/should be cleaned before a commit. @yguclu do you agree?

Copy link
Member

Choose a reason for hiding this comment

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

I am no Jupyter Notebook expert, but I think so, yes.

Copy link
Member

Choose a reason for hiding this comment

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

Not Yaman but I agree @campospinto. The metadata here is hardcoding Python version info which we're trying to avoid. @anushkasinghh please clean the notebook as stated in the guide:

# Clean notebook
nb-clean clean --remove-empty-cells --remove-all-notebook-metadata chapter1/poisson.ipynb

# Check if notebook is clean. No output means the notebook is already clean (otherwise you'll get an error)
nb-clean check chapter1/poisson.ipynb

Copy link
Member

Choose a reason for hiding this comment

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

@kvrigor I have noticed the cell IDs being changed in this PR. Is this something unavoidable, or we could keep the original values somehow?

Copy link
Member

Choose a reason for hiding this comment

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

My surface reading of this doc suggests that cell IDs should change whenever cells change, since the primary purpose of a cell ID is to uniquely identify cell contents. Unfortunately we can't avoid mutating cell IDs, and maybe that's one of the reasons why a Jupyter notebook isn't version-control friendly.

Copy link
Member

Choose a reason for hiding this comment

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

Is a cell ID something like a hash code? It seems to me that a new one could be generated when opening the notebook, rather than hardcoded in the file...

Copy link
Member

Choose a reason for hiding this comment

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

Is a cell ID something like a hash code?

It's possible; hardcoding it might be necessary for efficiency and also for scripting access by IDE tools.

"\n",
"domain = Square()\n",
"from sympy import pi, sin, lambdify\n",

Choose a reason for hiding this comment

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

git sees some changes because this import now comes after the line break. If you keep the same line breaks than in the original code, git will only see the relevant changes and the commit will be a bit cleaner.

"\n",
"V = ScalarFunctionSpace('V', domain)\n",
"domain = Square()\n",

Choose a reason for hiding this comment

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

same here: the only changes here are the position of the line breaks "\n",

" num = np.array([[uh(e1, e2) for e2 in eta2] for e1 in eta1])\n",
"\n",
" # Compute exact solution\n",
" ex = np.array([[phi_exact(e1, e2) for e2 in eta2] for e1 in eta1])\n",

Choose a reason for hiding this comment

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

it seems to me that this line triggers an error when the notebook is executed. @anushkasinghh did you verify that you could run the notebooks ?

When the CI tests are run with the PR (probably after each new commit) you can also check that the "book" (which will be deployed after this PR is merged) looks as it should, by downloading the artifacts as described in the readme.

But you should first check that you can run the notebook correctly before committing, that will be simpler :)

@anushkasinghh
Copy link
Author

closing as issues resolved in another pr

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