Skip to content

Commit 2a82830

Browse files
committed
[FIX] fixing the execution of updatepetjson and ecatheaderupdate
1 parent 7275c27 commit 2a82830

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

pypet2bids/pypet2bids/ecat_header_update.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import read_ecat
55
import helper_functions
66
except ImportError:
7-
from pypet2bids.ecat import ecat
8-
from pypet2bids.write_ecat import write_ecat
9-
from pypet2bids.read_ecat import read_ecat
10-
from pypet2bids import helper_functions
7+
import pypet2bids.ecat as ecat
8+
import pypet2bids.write_ecat as write_ecat
9+
import pypet2bids.read_ecat as read_ecat
10+
import pypet2bids.helper_functions as helper_functions
1111

1212
# collect ecat header jsons
1313
ecat_headers = read_ecat.ecat_header_maps.get("ecat_headers")

pypet2bids/pypet2bids/update_json_pet_file.py

100644100755
Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env python3
2+
13
from pathlib import Path
24
from os.path import join
35
from os import listdir
@@ -13,11 +15,15 @@
1315

1416
try:
1517
import helper_functions
16-
import is_pet
18+
# The import of is_pet is deferred to get_metadata_from_spreadsheet() to
19+
# prevent circular import
20+
#import is_pet
1721
import pet_metadata as metadata
1822
except ModuleNotFoundError:
1923
import pypet2bids.helper_functions as helper_functions
20-
import pypet2bids.is_pet as is_pet
24+
# The import of is_pet is deferred to get_metadata_from_spreadsheet() to
25+
# prevent circular import
26+
#import pypet2bids.is_pet as is_pet
2127
import pypet2bids.pet_metadata as metadata
2228

2329
# import logging
@@ -761,6 +767,12 @@ def get_metadata_from_spreadsheet(
761767
:return: dictionary of metadata
762768
:rtype: dict
763769
"""
770+
# Import is_pet here to avoid circular import
771+
try:
772+
import is_pet
773+
except ModuleNotFoundError:
774+
import pypet2bids.is_pet as is_pet
775+
764776
spreadsheet_metadata = {"nifti_json": {}, "blood_json": {}, "blood_tsv": {}}
765777
spreadsheet_values = {}
766778
if Path(metadata_path).is_file():

pypet2bids/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ convert-pmod-to-blood = "pypet2bids.convert_pmod_to_blood:main"
6464
ispet = "pypet2bids.is_pet:main"
6565
updatepetjsonfromdicom = "pypet2bids.dcm2niix4pet:update_json_with_dicom_value_cli"
6666
updatepetjsonfromecat = "pypet2bids.ecat_cli:update_json_with_ecat_value_cli"
67-
updatepetjson = "pypet2bids.update_json:update_json_cli"
68-
ecatheaderupdate = "pypet2bids.ecat_header_update:main"
67+
updatepetjson = "pypet2bids.update_json_pet_file:update_json_cli"
68+
ecatheaderupdate = "pypet2bids.ecat_header_update:cli"
6969

7070
[project.urls]
7171
Documentation = "https://pypet2bids.readthedocs.io/en/latest/"

0 commit comments

Comments
 (0)