|
3 | 3 | extract_args,
|
4 | 4 | get_source_code,
|
5 | 5 | split_source_into_statements,
|
| 6 | +) |
| 7 | +from nipype2pydra.statements import ( |
6 | 8 | ImportStatement,
|
7 | 9 | Imported,
|
8 | 10 | parse_imports,
|
@@ -130,7 +132,31 @@ def test_extract_args11():
|
130 | 132 |
|
131 | 133 |
|
132 | 134 | def test_extract_args12():
|
133 |
| - src = ' """\n Calculates the worst-case and best-case signal-to-noise ratio (SNR) within the corpus callosum.\n\n This function estimates the SNR in the corpus callosum (CC) by comparing the\n mean signal intensity within the CC mask to the standard deviation of the background\n signal (extracted from the b0 image). It performs separate calculations for\n each diffusion-weighted imaging (DWI) shell.\n\n **Worst-case SNR:** The mean signal intensity along the diffusion direction with the\n lowest signal is considered the worst-case scenario.\n\n **Best-case SNR:** The mean signal intensity averaged across the two diffusion\n directions with the highest signal is considered the best-case scenario.\n\n Parameters\n ----------\n in_b0 : :obj:`~numpy.ndarray` (float, 3D)\n T1-weighted or b0 image used for background signal estimation.\n dwi_shells : list[:obj:`~numpy.ndarray` (float, 4D)]\n List of DWI data for each diffusion shell.\n cc_mask : :obj:`~numpy.ndarray` (bool, 3D)\n Boolean mask of the corpus callosum.\n b_values : :obj:`~numpy.ndarray` (int)\n Array of b-values for each DWI volume in ``dwi_shells``.\n b_vectors : :obj:`~numpy.ndarray` (float)\n Array of diffusion-encoding vectors for each DWI volume in ``dwi_shells``.\n\n Returns\n -------\n cc_snr_estimates : :obj:`dict`\n Dictionary containing SNR estimates for each b-value. Keys are the b-values\n (integers), and values are tuples containing two elements:\n\n * The first element is the worst-case SNR (float).\n * The second element is the best-case SNR (float).\n\n """' |
| 135 | + src = ( |
| 136 | + ' """\n Calculates the worst-case and best-case signal-to-noise ratio (SNR) ' |
| 137 | + "within the corpus callosum.\n\n This function estimates the SNR in the corpus " |
| 138 | + "callosum (CC) by comparing the\n mean signal intensity within the CC mask to " |
| 139 | + "the standard deviation of the background\n signal (extracted from the b0 image). " |
| 140 | + "It performs separate calculations for\n each diffusion-weighted imaging (DWI) shell.\n\n " |
| 141 | + "**Worst-case SNR:** The mean signal intensity along the diffusion direction with the\n " |
| 142 | + "lowest signal is considered the worst-case scenario.\n\n " |
| 143 | + "**Best-case SNR:** The mean signal intensity averaged across the two diffusion\n " |
| 144 | + "directions with the highest signal is considered the best-case scenario.\n\n " |
| 145 | + "Parameters\n ----------\n in_b0 : :obj:`~numpy.ndarray` (float, 3D)\n " |
| 146 | + "T1-weighted or b0 image used for background signal estimation.\n " |
| 147 | + "dwi_shells : list[:obj:`~numpy.ndarray` (float, 4D)]\n " |
| 148 | + "List of DWI data for each diffusion shell.\n cc_mask : :obj:`~numpy.ndarray` " |
| 149 | + "(bool, 3D)\n Boolean mask of the corpus callosum.\n b_values : " |
| 150 | + ":obj:`~numpy.ndarray` (int)\n Array of b-values for each DWI volume in " |
| 151 | + "``dwi_shells``.\n b_vectors : :obj:`~numpy.ndarray` (float)\n " |
| 152 | + "Array of diffusion-encoding vectors for each DWI volume in ``dwi_shells``.\n\n " |
| 153 | + "Returns\n -------\n cc_snr_estimates : :obj:`dict`\n Dictionary " |
| 154 | + "containing SNR estimates for each b-value. Keys are the b-values\n " |
| 155 | + "(integers), and values are tuples containing two elements:\n\n " |
| 156 | + "* The first element is the worst-case SNR (float).\n * The second element " |
| 157 | + 'is the best-case SNR (float).\n\n """' |
| 158 | + ) |
| 159 | + assert extract_args(src) == (src, None, None) |
134 | 160 |
|
135 | 161 |
|
136 | 162 | def test_split_source_into_statements_tripple_quote():
|
@@ -537,7 +563,9 @@ def test_import_statement4():
|
537 | 563 |
|
538 | 564 |
|
539 | 565 | def test_import_statement_get_object1():
|
540 |
| - import_str = "from nipype2pydra.utils import ImportStatement, Imported as imp" |
| 566 | + import_str = ( |
| 567 | + "from nipype2pydra.statements.imports import ImportStatement, Imported as imp" |
| 568 | + ) |
541 | 569 | parsed = parse_imports(import_str)[0]
|
542 | 570 | assert parsed["imp"].object is Imported
|
543 | 571 | assert parsed["ImportStatement"].object is ImportStatement
|
|
0 commit comments