mathLab / PyGeM

Python Geometrical Morphing
http://mathlab.github.io/PyGeM/
Other
338 stars 118 forks source link

FFD parameter files not found #210

Closed e-dub closed 3 years ago

e-dub commented 3 years ago

I am trying to get my tutorials running again for LS-DYNA and Kratos (mdpa). I am having some problems with the new syntax.

I am following the documentation here: https://mathlab.github.io/PyGeM/ffd.html

The following code is not working

ffd.read_parameters('../tests/test_datasets/parameters_test_ffd_pipe_unv_C0.prm')

which is not recognizing the file and then trying to write a new file, see ffd.py line 249 and then giving the following error:

AttributeError: 'str' object has no attribute 'write_parameters'

Even if I comment this section, further errors occur below.

Any tips or help here?

mtezzele commented 3 years ago

Dear @e-dub, the problem you are experiencing is produced only with that particular parameter file or with a generic prm file? Are you sure you are running your python code from the correct path? It seems the path is wrong.

ndem0 commented 3 years ago

Dear @e-dub, it looks like you passed the wrong path for the parameter file (be careful in which directory you run the script). Anyway, even with the wrong filename, the method read_parameters should call the write_parameters one and create a new parameter file. In your case it looks that you object is a str insted a FFD object. Can you share with us all the script you are using?

e-dub commented 3 years ago

Servus,

@mtezzele and @ndem0 Thanks for the responses! @mtezzele It seems not to find any of the parameter files, which it did from the past versions. @ndem0 Definitely calling a file that exists as the command %cat works with it! See my ipython tutorials that I implemented last year.

Any advice how best to go from the "old way" to the "new way"?

ndem0 commented 3 years ago

In your case it looks that you object is a str insted a FFD object. Can you share with us all the script you are using?

e-dub commented 3 years ago

@ndem0 parameters_test_ffd_pipe_unv_C0.prm

ndem0 commented 3 years ago

That is the parameters file, not the Python script you are running.

e-dub commented 3 years ago

@ndem0 tutorial-6-k.ipynb tutorial-7-mdpa.ipynb

mtezzele commented 3 years ago

@e-dub in those tutorials there is no variable called ffd (the one you posted in the first post here). Can you paste here the exact line where you define the variable ffd?

ndem0 commented 3 years ago

Those are the tutorials made for previous version. It is highly probable that some errors occur, as you can see from the tutorial README (https://github.com/mathLab/PyGeM/blob/master/tutorials/README.md) or in Issue #194. Please, follow the documentation (the page you linked) to update the tutorial(s).

Moreover, I kindly ask you to better detail your problems when you are asking help: the line of code you past (ffd.read_parameters('../tests/test_datasets/parameters_test_ffd_pipe_unv_C0.prm')) is not present in the tutorials 6 and 7. So again please SHARE HERE the exact script you are using (It is the third times I ask it) otherwise we will never be able to understand your situation.

e-dub commented 3 years ago

@ndem spezi... @ndem0 @mtezzele I am trying to get these tutorials working again with the new code. I think the best way was to use ffd.read_parameters The code that I originally wrote was the following:

mdpa_handler = MdpaHandler()
mesh_points = mdpa_handler.parse('../tests/test_datasets/test_pipe.mdpa')

Maybe it is best to ask how you would solve this so that I can get them to work again.

ndem0 commented 3 years ago

I really encourage you to read the brief "changelog" we have written for the new version (https://github.com/mathLab/PyGeM/releases). I copy here for you:

- Move the python-occ to 'cad' submodule: from now on the 'python-occ' package is not mandatory for the installation, but only to access to this submodule. Tests are run according to the environment;
- Refactor the code, merging the parameter classes and the deformation ones (e.g. FFDParameters is encapsulated in FFD);
- Add CustomDeformation (both for CAD or discrete geometries);
- The Handlers classes for CAD are removed;
- The other Handlers are marked as deprecated (will be moved in next releases);
- Improvements in the CAD part, adding features to overcome the known issues.

Regarding your specific problem: now you posted a different two lines of codes (where actually the function read_parameters is not called) which is the opposite of what we were asking to you. In this way, it is extremely complicated (and time-demanding) understanding your problem and providing you a decent solution.

I'm going to close this issue because the many missing information and I invite you to open another issue WITH ALL THE FOLLOWING INFORMATION:

ndem0 commented 3 years ago

Update @e-dub: we've checked the tutorial 7 (the one that deals with MDPA files) in #211 and no particular errors occured, not during the parameters loading neither parsing the geometry file (new tutorial available at https://github.com/mathLab/PyGeM/blob/master/tutorials/tutorial-7-mdpa.ipynb). If you still obtain any issue, please open the issue with all the needed information.

e-dub commented 3 years ago

I got the Kratos mdpa file working. I am still working on the LS-Dyna k file. I will push them later this afternoon. I did not find the release easy to follow to update it for the new version and hope that this example with make things easier for anyone else updating them.