Skip to content

Commit

Permalink
Merge branch 'main' into coilcompress
Browse files Browse the repository at this point in the history
  • Loading branch information
fzimmermann89 authored Nov 7, 2024
2 parents f36b1dd + bc830f5 commit 3cdeafb
Show file tree
Hide file tree
Showing 22 changed files with 1,493 additions and 136 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-docstring-first
Expand All @@ -15,14 +15,14 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
rev: v0.7.2
hooks:
- id: ruff # linter
args: [--fix]
- id: ruff-format # formatter

- repo: https://github.com/crate-ci/typos
rev: v1.25.0
rev: v1.27.0
hooks:
- id: typos

Expand All @@ -34,7 +34,7 @@ repos:
exclude: ^tests/

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.13.0
hooks:
- id: mypy
pass_filenames: false
Expand Down
8 changes: 4 additions & 4 deletions examples/direct_reconstruction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
"\n",
"import requests\n",
"\n",
"data_file = tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.h5')\n",
"response = requests.get(zenodo_url + fname, timeout=30)\n",
"data_file.write(response.content)\n",
"data_file.flush()"
"with tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.h5') as data_file:\n",
" response = requests.get(zenodo_url + fname, timeout=30)\n",
" data_file.write(response.content)\n",
" data_file.flush()"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions examples/direct_reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

import requests

data_file = tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.h5')
response = requests.get(zenodo_url + fname, timeout=30)
data_file.write(response.content)
data_file.flush()
with tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.h5') as data_file:
response = requests.get(zenodo_url + fname, timeout=30)
data_file.write(response.content)
data_file.flush()

# %% [markdown]
# ### Image reconstruction
Expand Down
8 changes: 4 additions & 4 deletions examples/iterative_sense_reconstruction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
"\n",
"import requests\n",
"\n",
"data_file = tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.h5')\n",
"response = requests.get(zenodo_url + fname, timeout=30)\n",
"data_file.write(response.content)\n",
"data_file.flush()"
"with tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.h5') as data_file:\n",
" response = requests.get(zenodo_url + fname, timeout=30)\n",
" data_file.write(response.content)\n",
" data_file.flush()"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions examples/iterative_sense_reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

import requests

data_file = tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.h5')
response = requests.get(zenodo_url + fname, timeout=30)
data_file.write(response.content)
data_file.flush()
with tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.h5') as data_file:
response = requests.get(zenodo_url + fname, timeout=30)
data_file.write(response.content)
data_file.flush()

# %% [markdown]
# ### Image reconstruction
Expand Down
22 changes: 12 additions & 10 deletions examples/pulseq_2d_radial_golden_angle.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@
"cell_type": "code",
"execution_count": null,
"id": "d16f41f1",
"metadata": {},
"metadata": {
"lines_to_next_cell": 2
},
"outputs": [],
"source": [
"# define zenodo records URL and create a temporary directory and h5-file\n",
"zenodo_url = 'https://zenodo.org/records/10854057/files/'\n",
"fname = 'pulseq_radial_2D_402spokes_golden_angle_with_traj.h5'\n",
"data_file = tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.h5')"
"fname = 'pulseq_radial_2D_402spokes_golden_angle_with_traj.h5'"
]
},
{
Expand All @@ -50,9 +51,10 @@
"outputs": [],
"source": [
"# Download raw data using requests\n",
"response = requests.get(zenodo_url + fname, timeout=30)\n",
"data_file.write(response.content)\n",
"data_file.flush()"
"with tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.h5') as data_file:\n",
" response = requests.get(zenodo_url + fname, timeout=30)\n",
" data_file.write(response.content)\n",
" data_file.flush()"
]
},
{
Expand Down Expand Up @@ -125,10 +127,10 @@
"# download the sequence file from zenodo\n",
"zenodo_url = 'https://zenodo.org/records/10868061/files/'\n",
"seq_fname = 'pulseq_radial_2D_402spokes_golden_angle.seq'\n",
"seq_file = tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.seq')\n",
"response = requests.get(zenodo_url + seq_fname, timeout=30)\n",
"seq_file.write(response.content)\n",
"seq_file.flush()"
"with tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.seq') as seq_file:\n",
" response = requests.get(zenodo_url + seq_fname, timeout=30)\n",
" seq_file.write(response.content)\n",
" seq_file.flush()"
]
},
{
Expand Down
17 changes: 9 additions & 8 deletions examples/pulseq_2d_radial_golden_angle.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
# define zenodo records URL and create a temporary directory and h5-file
zenodo_url = 'https://zenodo.org/records/10854057/files/'
fname = 'pulseq_radial_2D_402spokes_golden_angle_with_traj.h5'
data_file = tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.h5')


# %%
# Download raw data using requests
response = requests.get(zenodo_url + fname, timeout=30)
data_file.write(response.content)
data_file.flush()
with tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.h5') as data_file:
response = requests.get(zenodo_url + fname, timeout=30)
data_file.write(response.content)
data_file.flush()

# %% [markdown]
# ### Image reconstruction using KTrajectoryIsmrmrd
Expand Down Expand Up @@ -62,10 +63,10 @@
# download the sequence file from zenodo
zenodo_url = 'https://zenodo.org/records/10868061/files/'
seq_fname = 'pulseq_radial_2D_402spokes_golden_angle.seq'
seq_file = tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.seq')
response = requests.get(zenodo_url + seq_fname, timeout=30)
seq_file.write(response.content)
seq_file.flush()
with tempfile.NamedTemporaryFile(mode='wb', delete=False, suffix='.seq') as seq_file:
response = requests.get(zenodo_url + seq_fname, timeout=30)
seq_file.write(response.content)
seq_file.flush()

# %%
# Read raw data and calculate trajectory using KTrajectoryPulseq
Expand Down
Loading

0 comments on commit 3cdeafb

Please sign in to comment.