jjhelmus / nmrglue

A module for working with NMR data in Python
BSD 3-Clause "New" or "Revised" License
211 stars 86 forks source link

Fix bug when passing specific procs_file in read_fid or read_pdata (Bruker imports) #134

Closed fernandezc closed 3 years ago

fernandezc commented 3 years ago

Passing proc and procs files location using parameter procs_files in read_fid or read_pdata generate an error.

dic, data = ng.bruker.read_pdata(specdir, procs_files = ["somepath/procs"])

generate an error:

        for f in ["procs", "proc2s", "proc3s", "proc4s"]:
>               if os.path.isfile(os.path.join(pdata_path, f)):
E               UnboundLocalError: local variable 'pdata_path' referenced before assignment

../bruker.py:611: UnboundLocalError

This pull request proposes to solve this problem by a modification of read_procs_file function in bruker.py. It adds also some changes in the read_acqus_file so that both functions can accept absolute path for acqu(s) and proc(s) files.