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

_mat_data seems orphan #2441

Closed
germa89 opened this issue Oct 24, 2023 · 4 comments
Closed

_mat_data seems orphan #2441

germa89 opened this issue Oct 24, 2023 · 4 comments

Comments

@germa89
Copy link
Collaborator

germa89 commented Oct 24, 2023

As the title.

Link:

def _mat_data(self, pname, raw=False):
"""Downloads matrix data from a parameter and returns a scipy sparse array"""
try:
from scipy import sparse
except ImportError: # pragma: no cover
raise ImportError("Install ``scipy`` to use this feature") from None
minfo = self._data_info(pname)
stype = ANSYS_VALUE_TYPE[minfo.stype]
mtype = minfo.objtype
shape = (minfo.size1, minfo.size2)
if mtype == 2: # dense
request = pb_types.ParameterRequest(name=pname)
chunks = self._stub.GetMatData(request)
values = parse_chunks(chunks, stype)
return np.transpose(np.reshape(values, shape[::-1]))
elif mtype == 3: # sparse
indptr = self._vec_data(pname + "::ROWS")
indices = self._vec_data(pname + "::COLS")
vals = self._vec_data(pname + "::VALS")
if raw: # for debug
return vals, indices, indptr, shape
else:
return sparse.csr_matrix(
(vals, indices, indptr), dtype=stype, shape=shape
)
raise ValueError(f'Invalid matrix type "{mtype}"')

@germa89
Copy link
Collaborator Author

germa89 commented Oct 24, 2023

It is not covered by tests either.

@germa89
Copy link
Collaborator Author

germa89 commented Nov 8, 2023

It is called by pyansys-math package...

https://github.com/search?q=repo%3Aansys%2Fpyansys-math%20_mat_data&type=code

I feel we should move it then there. Pinging @clatapie for feedback

@germa89
Copy link
Collaborator Author

germa89 commented Nov 8, 2023

Mmmhh.. naaahh.. It used quite a few MAPDL gRPC methods, then we better keep it here. But we should add some test then.

@germa89
Copy link
Collaborator Author

germa89 commented Nov 8, 2023

MMhh.. not even tests... It should be tested properly in pyansys-math. I'm closing this issue. If @clatapie wants to add tests here or in math, she is free to do it. I do not have the time!

@germa89 germa89 closed this as completed Nov 8, 2023
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

No branches or pull requests

1 participant