Skip to content

Commit 5362e6c

Browse files
download data... and fix training SNR
1 parent 40eb3a8 commit 5362e6c

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

.github/workflows/website.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
# Download Figures artifact
4141
- name: Download Figures artifact
4242

43-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
43+
#if: ${{ github.event.workflow_run.conclusion == 'success' }}
4444
uses: actions/download-artifact@v4
4545
with:
4646
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -50,7 +50,7 @@ jobs:
5050

5151
# Download Data artifact
5252
- name: Download Data artifact
53-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
53+
#if: ${{ github.event.workflow_run.conclusion == 'success' }}
5454
uses: actions/download-artifact@v4
5555
with:
5656
github-token: ${{ secrets.GITHUB_TOKEN }}

utilities/data_simulation/GenerateData.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,29 +185,27 @@ def simulate_training_data(self, bvalues, SNR = (5,100), n = 1000000, Drange = (
185185
- Noise is applied after generating noise-free IVIM signals, using either Gaussian or Rician noise.
186186
- Simulated signals are normalized by the mean S0 (b = 0) signal.
187187
"""
188-
test = self._rng.uniform(0, 1, (n, 3))
188+
test = self._rng.uniform(0, 1, (n, 4))
189189
D = Drange[0] + test[:, [0]] * (Drange[1] - Drange[0])
190190
f = frange[0] + test[:, [1]] * (frange[1] - frange[0])
191191
Dp = Dprange[0] + test[:, [2]] * (Dprange[1] - Dprange[0])
192192
#data_sim = np.zeros([len(D), len(bvalues)])
193193
bvalues = np.array(bvalues)
194194
if type(SNR) == tuple:
195-
test = self._rng.uniform(0, 1, (n, 1))
196-
SNR = np.exp(np.log(SNR[1]) + (test * (np.log(SNR[0]) - np.log(SNR[1]))))
195+
noise_std = 1/SNR[1] + test[:,4] * (1/SNR[0] - 1/SNR[1])
197196
addnoise = True
198197
elif SNR == 0:
199198
addnoise = False
200-
SNR = np.ones((n, 1))
199+
noise_std = np.ones((n, 1))
201200
else:
202-
SNR = np.full((n, 1), SNR)
201+
noise_std = np.full((n, 1), 1/SNR)
203202
addnoise = True
204203
# loop over array to fill with simulated IVIM data
205204
bvalues = np.array(bvalues).reshape(1, -1)
206205
data_sim = 1 * (f * np.exp(-bvalues * Dp) + (1 - f) * np.exp(-bvalues * D))
207206

208207
# if SNR is set to zero, don't add noise
209208
if addnoise:
210-
noise_std = 1 / SNR # shape (n, 1)
211209
noise_real = self._rng.normal(0, noise_std, data_sim.shape)
212210
noise_imag = self._rng.normal(0, noise_std, data_sim.shape)
213211

0 commit comments

Comments
 (0)