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

Strange/incorrect docs examples in ansys.mapdl.core.math #552

Closed
jgd10 opened this issue Aug 11, 2021 · 2 comments · Fixed by #554
Closed

Strange/incorrect docs examples in ansys.mapdl.core.math #552

jgd10 opened this issue Aug 11, 2021 · 2 comments · Fixed by #554
Assignees

Comments

@jgd10
Copy link
Contributor

jgd10 commented Aug 11, 2021

Describe the bug
Some of the examples in the docstrings in ansys.mapdl.core.math don't seem to be correct, although I'm not sure if it's this or if they are just unclear.

For example:

class AnsMat(ApdlMathObj):
...
    def asarray(self):
        """Returns vector as a numpy array

        Examples
        --------
        >>> from ansys.mapdl import Mapdl
        >>> mm = mapdl.math()
        >>> v = mm.ones(10)
        >>> v.asarray()
        [1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]
        """
        return self._mapdl._mat_data(self.id)

The example given uses the mapdl namespace but doesn't import it, and the import is importing Mapdl which isn't available at the level it is shown at. So I am assuming that it should read:

from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl()
mm = mapdl.math()
v = mm.ones(10)
v.asarray()

Am I understanding this correctly?

I noticed other ineeresting examples in the following docstirngs:

  • MapdlMath init
  • AnsVec asarray
  • AnsMat T
@jgd10 jgd10 added the Bug label Aug 11, 2021
@akaszynski
Copy link
Collaborator

This is broken and uses the older API and we need to fix this.

@jgd10 jgd10 self-assigned this Aug 11, 2021
@jgd10
Copy link
Contributor Author

jgd10 commented Aug 11, 2021

OK I'll take this on for now

akaszynski pushed a commit that referenced this issue Aug 12, 2021
* Edited examples in docstrings to use new API

Examples edited to use API where there were explicit errors being thrown
because the code wasn't recognised. All edited examples now run (and
have been tested) except for one matrix multiplication, which I will
raise a ticket for.

* readded examples accidentally deleted

* added newline after example
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 a pull request may close this issue.

2 participants