Skip to content

Commit

Permalink
Generalize scan information
Browse files Browse the repository at this point in the history
  • Loading branch information
marinagrprat committed Oct 7, 2020
1 parent b2c277f commit e7751b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 6 additions & 3 deletions pyxnat/core/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,7 @@ def __repr__(self):
project_id = uri_last(self._uri)

# Check if project exists

if self.exists():

# Fetch data project
Expand Down Expand Up @@ -1440,6 +1441,7 @@ def __repr__(self):
subject_id = uri_last(self._uri)

# Check if subject exists

if self.exists():

# Fetch data subject
Expand Down Expand Up @@ -1696,12 +1698,12 @@ def __repr__(self):
experiment_id = uri_nextlast(uri_parent(self._uri))

# Check if subject exists

if self.exists():

# Fetch data scan
data = self.attrs.mget(['type', 'frames', 'quality', 'series_description',
'fieldStrength'])
labels = ['Type', 'Frames', 'Quality', 'Series Description', 'Field Strength']
data = self.attrs.mget(['type', 'frames', 'quality'])
labels = ['Type', 'Frames', 'Quality']

# Creating the project url
url = interface._server + self._uri
Expand Down Expand Up @@ -1748,6 +1750,7 @@ def __repr__(self):
resource_id = uri_last(self._uri)

# Check if resource exists

if self.exists():

# Fetch data files
Expand Down
3 changes: 1 addition & 2 deletions pyxnat/tests/repr_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ def test_info_scan():
assert isinstance(scan_1, object)
expected_output = '\n' + 'Scan: 11 https://central.xnat.org/data/projects/surfmask_smpl/subjects/CENTRAL_S01791' \
'/experiments/CENTRAL_E04850/scans/11' \
+ '\n' + 'Experiment: CENTRAL_E04850' + '\n' + 'Type: SPGR' + '\n' + 'Frames: 175' \
+ '\n' + 'Series Description: SPGR' + '\n' + 'Field Strength: 3.0'
+ '\n' + 'Experiment: CENTRAL_E04850' + '\n' + 'Type: SPGR' + '\n' + 'Frames: 175'
assert list(sorted(str(scan_1))) == list(sorted(expected_output))


Expand Down

0 comments on commit e7751b9

Please sign in to comment.