imr-framework / py2jemris

Python library for interfacing with JEMRIS
GNU General Public License v3.0
2 stars 1 forks source link

save_grad_library_info issue in seq2xml function #1

Open ZemaTimoteo opened 3 years ago

ZemaTimoteo commented 3 years ago

Hi @tonggehua ,

Thank you for your help so far. However, when i tried to run in the updated tool ´py2jemris´ tool I got now a new issue, which is the following (direct report i got in pycharm):

Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.4\plugins\python-ce\helpers\pydev\pydevd.py", line 1434, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.4\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "D:/Tiago/Trabalho/2021_2025_PhD/Projects/qMRI_Joint/Code/pythonCode/Sequence/MSE/test_MSE_SEQfile_test.py", line 360, in <module> seq2xml(seq, seq_name, out_folder) File "D:/Tiago/Trabalho/2021_2025_PhD/Projects/Toolboxes/Python/py2jemris\seq2xml.py", line 66, in seq2xml grad_shapes_path_dict = save_grad_library_info(seq, out_folder) File "D:/Tiago/Trabalho/2021_2025_PhD/Projects/Toolboxes/Python/py2jemris\seq2xml.py", line 264, in save_grad_library_info t_points = this_block.gx.t AttributeError: 'types.SimpleNamespace' object has no attribute 't'

What should I do to overcome this?

P.S. I also had to change the len(seq.grad_library.data[g_ind]) == 5 instead of ==3

Important info:

tonggehua commented 3 years ago

@ZemaTimoteo Hello, thanks for moving over to the new repo. Could you provide (1) The exact PyPulseq version installed and (2) The script test_MSE_SEQfile_test.py? My current code for testing it that runs with no errors is provided below. I am using Python version 3.6 and PyPulseq version 1.2.0.post3.

import numpy as np
from pypulseq.Sequence.sequence import Sequence

seq = Sequence()
seq.read('MSE.seq')
seq2xml(seq,seq_name='MSE',out_folder='.')
ZemaTimoteo commented 3 years ago

Hi @tonggehua

The version of pypulseq I am using is the 1.2.0 (1);

Also, here is the code I am using for the MSE sequence (2): https://drive.google.com/file/d/1-5Am2AkLzPdAQKSHN5ag8fyno5exdsyJ/view?usp=sharing

tonggehua commented 3 years ago

@ZemaTimoteo Thank you for the info. Is it feasible for you to switch to the latest version of PyPulseq? I believe that it should work then and you can try simulating after you do.

ZemaTimoteo commented 3 years ago

@tonggehua I did as you suggested. (i did pip install pypulseq -U lattestPyPulseq version)

Nevertheless I still get the same mistake regarding the missing time field in the seq structure. I have no clue why.

Any other suggestion?

Thank you for your help and support

tonggehua commented 3 years ago

@ZemaTimoteo I looked into it. Right now there is a quick fix : run seq.read(save_path) on the previous saved file before passing the object into seq2xml and the number of fields for arbitrary gradients (which includes any extended gradients) should be fixed back to 3. I need to communicate with the Pypulseq person to see why the seq object changes between (1) before seq.write() and (2) after seq.read(). Please let me know if that works for you!