diff --git a/src/pypulseq/Sequence/ext_test_report.py b/src/pypulseq/Sequence/ext_test_report.py index 83e558f5..0447811a 100644 --- a/src/pypulseq/Sequence/ext_test_report.py +++ b/src/pypulseq/Sequence/ext_test_report.py @@ -31,6 +31,9 @@ def ext_test_report(self) -> str: k_traj_adc, _, t_excitation, _, t_adc = self.calculate_kspace() t_excitation = np.asarray(t_excitation) + # remove all ADC events that come before the first RF event (noise scans or alike) + t_adc = t_adc[t_adc > t_excitation[0]] + k_abs_adc = np.sqrt(np.sum(np.square(k_traj_adc), axis=0)) k_abs_echo, index_echo = np.min(k_abs_adc), np.argmin(k_abs_adc) t_echo = t_adc[index_echo] diff --git a/tests/expected_output/seq5.seq b/tests/expected_output/seq5.seq new file mode 100644 index 00000000..8bdb7140 --- /dev/null +++ b/tests/expected_output/seq5.seq @@ -0,0 +1,1314 @@ +# Pulseq sequence file +# Created by PyPulseq + +[VERSION] +major 1 +minor 4 +revision 2 + +[DEFINITIONS] +AdcRasterTime 1e-07 +BlockDurationRaster 1e-05 +GradientRasterTime 1e-05 +RadiofrequencyRasterTime 1e-06 +TotalDuration 0.5002 + +# Format of blocks: +# NUM DUR RF GX GY GZ ADC EXT +[BLOCKS] + 1 0 0 0 0 0 0 2 + 2 100 0 0 0 0 1 3 + 3 0 0 0 0 0 0 4 + 4 0 0 0 0 0 0 0 + 5 138 1 0 0 1 0 0 + 6 100 0 2 3 4 0 0 + 7 322 0 5 0 0 2 1 + 8 1000 0 2 6 0 0 0 + 9 138 1 0 0 1 0 0 + 10 100 0 2 7 4 0 0 + 11 322 0 5 0 0 2 5 + 12 1000 0 2 8 0 0 0 + 13 138 1 0 0 1 0 0 + 14 100 0 2 9 4 0 0 + 15 322 0 5 0 0 2 6 + 16 1000 0 2 10 0 0 0 + 17 138 1 0 0 1 0 0 + 18 100 0 2 11 4 0 0 + 19 322 0 5 0 0 2 7 + 20 1000 0 2 12 0 0 0 + 21 138 1 0 0 1 0 0 + 22 100 0 2 13 4 0 0 + 23 322 0 5 0 0 2 8 + 24 1000 0 2 14 0 0 0 + 25 138 1 0 0 1 0 0 + 26 100 0 2 15 4 0 0 + 27 322 0 5 0 0 2 9 + 28 1000 0 2 16 0 0 0 + 29 138 1 0 0 1 0 0 + 30 100 0 2 17 4 0 0 + 31 322 0 5 0 0 2 10 + 32 1000 0 2 18 0 0 0 + 33 138 1 0 0 1 0 0 + 34 100 0 2 19 4 0 0 + 35 322 0 5 0 0 2 11 + 36 1000 0 2 20 0 0 0 + 37 138 1 0 0 1 0 0 + 38 100 0 2 21 4 0 0 + 39 322 0 5 0 0 2 12 + 40 1000 0 2 22 0 0 0 + 41 138 1 0 0 1 0 0 + 42 100 0 2 23 4 0 0 + 43 322 0 5 0 0 2 13 + 44 1000 0 2 24 0 0 0 + 45 138 1 0 0 1 0 0 + 46 100 0 2 25 4 0 0 + 47 322 0 5 0 0 2 14 + 48 1000 0 2 26 0 0 0 + 49 138 1 0 0 1 0 0 + 50 100 0 2 27 4 0 0 + 51 322 0 5 0 0 2 15 + 52 1000 0 2 28 0 0 0 + 53 138 1 0 0 1 0 0 + 54 100 0 2 29 4 0 0 + 55 322 0 5 0 0 2 16 + 56 1000 0 2 30 0 0 0 + 57 138 1 0 0 1 0 0 + 58 100 0 2 31 4 0 0 + 59 322 0 5 0 0 2 17 + 60 1000 0 2 32 0 0 0 + 61 138 1 0 0 1 0 0 + 62 100 0 2 33 4 0 0 + 63 322 0 5 0 0 2 18 + 64 1000 0 2 34 0 0 0 + 65 138 1 0 0 1 0 0 + 66 100 0 2 35 4 0 0 + 67 322 0 5 0 0 2 19 + 68 1000 0 2 36 0 0 0 + 69 138 1 0 0 1 0 0 + 70 100 0 2 37 4 0 0 + 71 322 0 5 0 0 2 20 + 72 1000 0 2 37 0 0 0 + 73 138 1 0 0 1 0 0 + 74 100 0 2 36 4 0 0 + 75 322 0 5 0 0 2 21 + 76 1000 0 2 35 0 0 0 + 77 138 1 0 0 1 0 0 + 78 100 0 2 34 4 0 0 + 79 322 0 5 0 0 2 22 + 80 1000 0 2 33 0 0 0 + 81 138 1 0 0 1 0 0 + 82 100 0 2 32 4 0 0 + 83 322 0 5 0 0 2 23 + 84 1000 0 2 31 0 0 0 + 85 138 1 0 0 1 0 0 + 86 100 0 2 30 4 0 0 + 87 322 0 5 0 0 2 24 + 88 1000 0 2 29 0 0 0 + 89 138 1 0 0 1 0 0 + 90 100 0 2 28 4 0 0 + 91 322 0 5 0 0 2 25 + 92 1000 0 2 27 0 0 0 + 93 138 1 0 0 1 0 0 + 94 100 0 2 26 4 0 0 + 95 322 0 5 0 0 2 26 + 96 1000 0 2 25 0 0 0 + 97 138 1 0 0 1 0 0 + 98 100 0 2 24 4 0 0 + 99 322 0 5 0 0 2 27 +100 1000 0 2 23 0 0 0 +101 138 1 0 0 1 0 0 +102 100 0 2 22 4 0 0 +103 322 0 5 0 0 2 28 +104 1000 0 2 21 0 0 0 +105 138 1 0 0 1 0 0 +106 100 0 2 20 4 0 0 +107 322 0 5 0 0 2 29 +108 1000 0 2 19 0 0 0 +109 138 1 0 0 1 0 0 +110 100 0 2 18 4 0 0 +111 322 0 5 0 0 2 30 +112 1000 0 2 17 0 0 0 +113 138 1 0 0 1 0 0 +114 100 0 2 16 4 0 0 +115 322 0 5 0 0 2 31 +116 1000 0 2 15 0 0 0 +117 138 1 0 0 1 0 0 +118 100 0 2 14 4 0 0 +119 322 0 5 0 0 2 32 +120 1000 0 2 13 0 0 0 +121 138 1 0 0 1 0 0 +122 100 0 2 12 4 0 0 +123 322 0 5 0 0 2 33 +124 1000 0 2 11 0 0 0 +125 138 1 0 0 1 0 0 +126 100 0 2 10 4 0 0 +127 322 0 5 0 0 2 34 +128 1000 0 2 9 0 0 0 +129 138 1 0 0 1 0 0 +130 100 0 2 8 4 0 0 +131 322 0 5 0 0 2 35 +132 1000 0 2 7 0 0 0 + +# Format of RF events: +# id amplitude mag_id phase_id time_shape_id delay freq phase +# .. Hz .... .... .... us Hz rad +[RF] +1 276.907 1 2 0 190 0 0 + +# Format of trapezoid gradients: +# id amplitude rise flat fall delay +# .. Hz/m us us us us +[TRAP] + 1 1.33333e+06 190 1000 190 0 + 2 -58791.2 90 820 90 0 + 3 58608.1 90 820 90 0 + 4 -1.68794e+06 240 230 240 0 + 5 33333.3 10 3200 10 0 + 6 -58608.1 90 820 90 0 + 7 54945.1 90 820 90 0 + 8 -54945.1 90 820 90 0 + 9 51282.1 90 820 90 0 +10 -51282.1 90 820 90 0 +11 47101.4 80 840 80 0 +12 -47101.4 80 840 80 0 +13 43478.3 80 840 80 0 +14 -43478.3 80 840 80 0 +15 39855.1 80 840 80 0 +16 -39855.1 80 840 80 0 +17 35842.3 70 860 70 0 +18 -35842.3 70 860 70 0 +19 32258.1 70 860 70 0 +20 -32258.1 70 860 70 0 +21 28673.8 70 860 70 0 +22 -28673.8 70 860 70 0 +23 24822.7 60 880 60 0 +24 -24822.7 60 880 60 0 +25 21276.6 60 880 60 0 +26 -21276.6 60 880 60 0 +27 17543.9 50 900 50 0 +28 -17543.9 50 900 50 0 +29 14035.1 50 900 50 0 +30 -14035.1 50 900 50 0 +31 10416.7 40 920 40 0 +32 -10416.7 40 920 40 0 +33 6944.44 40 920 40 0 +34 -6944.44 40 920 40 0 +35 3436.43 30 940 30 0 +36 -3436.43 30 940 30 0 +37 -0 10 980 10 0 + +# Format of ADC events: +# id num dwell delay freq phase +# .. .. ns us Hz rad +[ADC] +1 1000 1000 0 0 0 +2 32 100000 10 0 0 + +# Format of extension lists: +# id type ref next_id +# next_id of 0 terminates the list +# Extension list is followed by extension specifications +[EXTENSIONS] +1 1 1 0 +2 1 2 1 +3 1 3 0 +4 1 4 0 +5 1 5 0 +6 1 6 0 +7 1 7 0 +8 1 8 0 +9 1 9 0 +10 1 10 0 +11 1 11 0 +12 1 12 0 +13 1 13 0 +14 1 14 0 +15 1 15 0 +16 1 16 0 +17 1 17 0 +18 1 18 0 +19 1 19 0 +20 1 20 0 +21 1 21 0 +22 1 22 0 +23 1 23 0 +24 1 24 0 +25 1 25 0 +26 1 26 0 +27 1 27 0 +28 1 28 0 +29 1 29 0 +30 1 30 0 +31 1 31 0 +32 1 32 0 +33 1 33 0 +34 1 34 0 +35 1 35 0 + +# Extension specification for setting labels: +# id set labelstring +extension LABELSET 1 +1 0 LIN +2 0 SLC +3 1 NOISE +4 0 NOISE +5 1 LIN +6 2 LIN +7 3 LIN +8 4 LIN +9 5 LIN +10 6 LIN +11 7 LIN +12 8 LIN +13 9 LIN +14 10 LIN +15 11 LIN +16 12 LIN +17 13 LIN +18 14 LIN +19 15 LIN +20 16 LIN +21 17 LIN +22 18 LIN +23 19 LIN +24 20 LIN +25 21 LIN +26 22 LIN +27 23 LIN +28 24 LIN +29 25 LIN +30 26 LIN +31 27 LIN +32 28 LIN +33 29 LIN +34 30 LIN +35 31 LIN + +# Sequence Shapes +[SHAPES] + +shape_id 1 +num_samples 1000 +0.001001001 +0.00300886869 +0.00502433213 +0.00704711925 +0.00907695593 +0.011113566 +0.0131566713 +0.0152059917 +0.017261245 +0.0193221473 +0.0213884125 +0.023459753 +0.0255358792 +0.0276164996 +0.0297013211 +0.0317900488 +0.0338823861 +0.0359780348 +0.0380766951 +0.0401780654 +0.0422818427 +0.0443877225 +0.0464953987 +0.0486045638 +0.050714909 +0.0528261238 +0.0549378966 +0.0570499144 +0.0591618631 +0.0612734269 +0.0633842894 +0.0654941325 +0.0676026372 +0.0697094836 +0.0718143503 +0.0739169152 +0.0760168551 +0.078113846 +0.0802075628 +0.0822976796 +0.0843838697 +0.0864658057 +0.0885431592 +0.0906156012 +0.0926828023 +0.0947444321 +0.0968001597 +0.0988496537 +0.100892582 +0.102928613 +0.104957413 +0.106978649 +0.108991988 +0.110997095 +0.112993637 +0.114981279 +0.116959687 +0.118928525 +0.12088746 +0.122836156 +0.124774278 +0.126701492 +0.128617463 +0.130521856 +0.132414336 +0.134294569 +0.136162222 +0.13801696 +0.139858449 +0.141686357 +0.143500351 +0.145300098 +0.147085267 +0.148855526 +0.150610545 +0.152349994 +0.154073542 +0.155780861 +0.157471624 +0.159145503 +0.160802171 +0.162441303 +0.164062574 +0.165665662 +0.167250242 +0.168815993 +0.170362595 +0.171889728 +0.173397074 +0.174884316 +0.176351138 +0.177797226 +0.179222265 +0.180625945 +0.182007955 +0.183367986 +0.184705731 +0.186020883 +0.187313138 +0.188582193 +0.189827748 +0.191049503 +0.19224716 +0.193420424 +0.194569001 +0.195692597 +0.196790924 +0.197863693 +0.198910617 +0.199931412 +0.200925797 +0.20189349 +0.202834214 +0.203747694 +0.204633655 +0.205491826 +0.206321939 +0.207123726 +0.207896924 +0.20864127 +0.209356505 +0.210042373 +0.210698618 +0.211324989 +0.211921237 +0.212487114 +0.213022378 +0.213526787 +0.214000102 +0.214442088 +0.214852512 +0.215231144 +0.215577756 +0.215892124 +0.216174028 +0.216423248 +0.21663957 +0.216822781 +0.216972672 +0.217089037 +0.217171673 +0.217220381 +0.217234963 +0.217215227 +0.217160983 +0.217072044 +0.216948227 +0.216789351 +0.21659524 +0.216365722 +0.216100625 +0.215799784 +0.215463037 +0.215090223 +0.214681188 +0.214235779 +0.213753848 +0.21323525 +0.212679844 +0.212087492 +0.211458061 +0.210791421 +0.210087446 +0.209346012 +0.208567002 +0.2077503 +0.206895796 +0.206003383 +0.205072957 +0.20410442 +0.203097675 +0.202052632 +0.200969203 +0.199847305 +0.198686858 +0.197487787 +0.196250022 +0.194973494 +0.19365814 +0.192303903 +0.190910725 +0.189478558 +0.188007355 +0.186497072 +0.184947672 +0.18335912 +0.181731387 +0.180064448 +0.17835828 +0.176612867 +0.174828196 +0.173004258 +0.171141048 +0.169238568 +0.16729682 +0.165315814 +0.163295562 +0.161236081 +0.159137394 +0.156999525 +0.154822505 +0.152606368 +0.150351154 +0.148056905 +0.14572367 +0.143351499 +0.14094045 +0.138490582 +0.136001962 +0.133474658 +0.130908744 +0.128304299 +0.125661404 +0.122980148 +0.12026062 +0.117502918 +0.11470714 +0.111873391 +0.10900178 +0.10609242 +0.103145429 +0.100160928 +0.0971390435 +0.0940799061 +0.0909836506 +0.0878504161 +0.0846803461 +0.0814735886 +0.0782302954 +0.0749506232 +0.0716347325 +0.0682827884 +0.06489496 +0.0614714209 +0.0580123489 +0.0545179258 +0.0509883379 +0.0474237756 +0.0438244335 +0.0401905103 +0.036522209 +0.0328197366 +0.0290833045 +0.0253131278 +0.0215094262 +0.017672423 +0.013802346 +0.00989942667 +0.00596390077 +0.00199600798 +0.00200400802 +0.00603589957 +0.0100994151 +0.014194299 +0.0183202919 +0.0224771304 +0.0266645474 +0.0308822718 +0.0351300286 +0.0394075394 +0.0437145216 +0.0480506891 +0.052415752 +0.0568094167 +0.0612313859 +0.0656813588 +0.0701590308 +0.0746640938 +0.0791962362 +0.0837551428 +0.0883404949 +0.0929519703 +0.0975892434 +0.102251985 +0.106939863 +0.111652542 +0.116389682 +0.121150942 +0.125935975 +0.130744433 +0.135575963 +0.140430211 +0.145306818 +0.150205423 +0.155125662 +0.160067166 +0.165029566 +0.170012488 +0.175015557 +0.180038392 +0.185080612 +0.190141832 +0.195221664 +0.200319719 +0.205435603 +0.210568921 +0.215719275 +0.220886263 +0.226069483 +0.231268529 +0.236482993 +0.241712464 +0.246956529 +0.252214773 +0.257486779 +0.262772126 +0.268070393 +0.273381155 +0.278703987 +0.28403846 +0.289384144 +0.294740606 +0.300107413 +0.305484129 +0.310870314 +0.316265531 +0.321669336 +0.327081288 +0.332500941 +0.337927849 +0.343361564 +0.348801637 +0.354247615 +0.359699048 +0.365155482 +0.37061646 +0.376081527 +0.381550226 +0.387022096 +0.39249668 +0.397973514 +0.403452138 +0.408932089 +0.414412901 +0.419894111 +0.425375253 +0.430855859 +0.436335464 +0.441813598 +0.447289793 +0.452763581 +0.45823449 +0.463702052 +0.469165794 +0.474625247 +0.480079938 +0.485529396 +0.490973149 +0.496410725 +0.501841651 +0.507265454 +0.512681663 +0.518089805 +0.523489407 +0.528879998 +0.534261104 +0.539632255 +0.544992978 +0.550342802 +0.555681256 +0.561007869 +0.566322172 +0.571623694 +0.576911968 +0.582186523 +0.587446893 +0.59269261 +0.597923209 +0.603138223 +0.608337189 +0.613519643 +0.618685121 +0.623833162 +0.628963307 +0.634075094 +0.639168067 +0.644241768 +0.64929574 +0.654329531 +0.659342686 +0.664334755 +0.669305286 +0.674253831 +0.679179944 +0.684083178 +0.68896309 +0.693819238 +0.698651182 +0.703458483 +0.708240704 +0.71299741 +0.71772817 +0.722432552 +0.727110128 +0.73176047 +0.736383155 +0.74097776 +0.745543866 +0.750081054 +0.75458891 +0.759067019 +0.763514973 +0.767932362 +0.772318781 +0.776673827 +0.7809971 +0.785288201 +0.789546737 +0.793772314 +0.797964543 +0.802123037 +0.806247413 +0.81033729 +0.814392289 +0.818412036 +0.822396158 +0.826344288 +0.830256059 +0.834131108 +0.837969077 +0.841769609 +0.845532351 +0.849256954 +0.852943072 +0.856590361 +0.860198484 +0.863767103 +0.867295886 +0.870784505 +0.874232635 +0.877639954 +0.881006143 +0.88433089 +0.887613883 +0.890854815 +0.894053384 +0.897209291 +0.90032224 +0.90339194 +0.906418104 +0.909400448 +0.912338693 +0.915232564 +0.918081788 +0.920886099 +0.923645234 +0.926358934 +0.929026944 +0.931649012 +0.934224894 +0.936754347 +0.939237132 +0.941673017 +0.944061772 +0.946403173 +0.948696999 +0.950943034 +0.953141066 +0.955290889 +0.9573923 +0.9594451 +0.961449097 +0.963404101 +0.965309928 +0.967166397 +0.968973335 +0.97073057 +0.972437936 +0.974095272 +0.975702422 +0.977259233 +0.978765559 +0.980221257 +0.98162619 +0.982980225 +0.984283233 +0.985535092 +0.986735684 +0.987884894 +0.988982613 +0.990028739 +0.991023172 +0.991965817 +0.992856587 +0.993695395 +0.994482164 +0.995216818 +0.995899288 +0.996529509 +0.997107422 +0.997632971 +0.998106108 +0.998526787 +0.998894968 +0.999210617 +0.999473703 +0.999684202 +0.999842093 +0.999947363 +1 +1 +0.999947363 +0.999842093 +0.999684202 +0.999473703 +0.999210617 +0.998894968 +0.998526787 +0.998106108 +0.997632971 +0.997107422 +0.996529509 +0.995899288 +0.995216818 +0.994482164 +0.993695395 +0.992856587 +0.991965817 +0.991023172 +0.990028739 +0.988982613 +0.987884894 +0.986735684 +0.985535092 +0.984283233 +0.982980225 +0.98162619 +0.980221257 +0.978765559 +0.977259233 +0.975702422 +0.974095272 +0.972437936 +0.97073057 +0.968973335 +0.967166397 +0.965309928 +0.963404101 +0.961449097 +0.9594451 +0.9573923 +0.955290889 +0.953141066 +0.950943034 +0.948696999 +0.946403173 +0.944061772 +0.941673017 +0.939237132 +0.936754347 +0.934224894 +0.931649012 +0.929026944 +0.926358934 +0.923645234 +0.920886099 +0.918081788 +0.915232564 +0.912338693 +0.909400448 +0.906418104 +0.90339194 +0.90032224 +0.897209291 +0.894053384 +0.890854815 +0.887613883 +0.88433089 +0.881006143 +0.877639954 +0.874232635 +0.870784505 +0.867295886 +0.863767103 +0.860198484 +0.856590361 +0.852943072 +0.849256954 +0.845532351 +0.841769609 +0.837969077 +0.834131108 +0.830256059 +0.826344288 +0.822396158 +0.818412036 +0.814392289 +0.81033729 +0.806247413 +0.802123037 +0.797964543 +0.793772314 +0.789546737 +0.785288201 +0.7809971 +0.776673827 +0.772318781 +0.767932362 +0.763514973 +0.759067019 +0.75458891 +0.750081054 +0.745543866 +0.74097776 +0.736383155 +0.73176047 +0.727110128 +0.722432552 +0.71772817 +0.71299741 +0.708240704 +0.703458483 +0.698651182 +0.693819238 +0.68896309 +0.684083178 +0.679179944 +0.674253831 +0.669305286 +0.664334755 +0.659342686 +0.654329531 +0.64929574 +0.644241768 +0.639168067 +0.634075094 +0.628963307 +0.623833162 +0.618685121 +0.613519643 +0.608337189 +0.603138223 +0.597923209 +0.59269261 +0.587446893 +0.582186523 +0.576911968 +0.571623694 +0.566322172 +0.561007869 +0.555681256 +0.550342802 +0.544992978 +0.539632255 +0.534261104 +0.528879998 +0.523489407 +0.518089805 +0.512681663 +0.507265454 +0.501841651 +0.496410725 +0.490973149 +0.485529396 +0.480079938 +0.474625247 +0.469165794 +0.463702052 +0.45823449 +0.452763581 +0.447289793 +0.441813598 +0.436335464 +0.430855859 +0.425375253 +0.419894111 +0.414412901 +0.408932089 +0.403452138 +0.397973514 +0.39249668 +0.387022096 +0.381550226 +0.376081527 +0.37061646 +0.365155482 +0.359699048 +0.354247615 +0.348801637 +0.343361564 +0.337927849 +0.332500941 +0.327081288 +0.321669336 +0.316265531 +0.310870314 +0.305484129 +0.300107413 +0.294740606 +0.289384144 +0.28403846 +0.278703987 +0.273381155 +0.268070393 +0.262772126 +0.257486779 +0.252214773 +0.246956529 +0.241712464 +0.236482993 +0.231268529 +0.226069483 +0.220886263 +0.215719275 +0.210568921 +0.205435603 +0.200319719 +0.195221664 +0.190141832 +0.185080612 +0.180038392 +0.175015557 +0.170012488 +0.165029566 +0.160067166 +0.155125662 +0.150205423 +0.145306818 +0.140430211 +0.135575963 +0.130744433 +0.125935975 +0.121150942 +0.116389682 +0.111652542 +0.106939863 +0.102251985 +0.0975892434 +0.0929519703 +0.0883404949 +0.0837551428 +0.0791962362 +0.0746640938 +0.0701590308 +0.0656813588 +0.0612313859 +0.0568094167 +0.052415752 +0.0480506891 +0.0437145216 +0.0394075394 +0.0351300286 +0.0308822718 +0.0266645474 +0.0224771304 +0.0183202919 +0.014194299 +0.0100994151 +0.00603589957 +0.00200400802 +0.00199600798 +0.00596390077 +0.00989942667 +0.013802346 +0.017672423 +0.0215094262 +0.0253131278 +0.0290833045 +0.0328197366 +0.036522209 +0.0401905103 +0.0438244335 +0.0474237756 +0.0509883379 +0.0545179258 +0.0580123489 +0.0614714209 +0.06489496 +0.0682827884 +0.0716347325 +0.0749506232 +0.0782302954 +0.0814735886 +0.0846803461 +0.0878504161 +0.0909836506 +0.0940799061 +0.0971390435 +0.100160928 +0.103145429 +0.10609242 +0.10900178 +0.111873391 +0.11470714 +0.117502918 +0.12026062 +0.122980148 +0.125661404 +0.128304299 +0.130908744 +0.133474658 +0.136001962 +0.138490582 +0.14094045 +0.143351499 +0.14572367 +0.148056905 +0.150351154 +0.152606368 +0.154822505 +0.156999525 +0.159137394 +0.161236081 +0.163295562 +0.165315814 +0.16729682 +0.169238568 +0.171141048 +0.173004258 +0.174828196 +0.176612867 +0.17835828 +0.180064448 +0.181731387 +0.18335912 +0.184947672 +0.186497072 +0.188007355 +0.189478558 +0.190910725 +0.192303903 +0.19365814 +0.194973494 +0.196250022 +0.197487787 +0.198686858 +0.199847305 +0.200969203 +0.202052632 +0.203097675 +0.20410442 +0.205072957 +0.206003383 +0.206895796 +0.2077503 +0.208567002 +0.209346012 +0.210087446 +0.210791421 +0.211458061 +0.212087492 +0.212679844 +0.21323525 +0.213753848 +0.214235779 +0.214681188 +0.215090223 +0.215463037 +0.215799784 +0.216100625 +0.216365722 +0.21659524 +0.216789351 +0.216948227 +0.217072044 +0.217160983 +0.217215227 +0.217234963 +0.217220381 +0.217171673 +0.217089037 +0.216972672 +0.216822781 +0.21663957 +0.216423248 +0.216174028 +0.215892124 +0.215577756 +0.215231144 +0.214852512 +0.214442088 +0.214000102 +0.213526787 +0.213022378 +0.212487114 +0.211921237 +0.211324989 +0.210698618 +0.210042373 +0.209356505 +0.20864127 +0.207896924 +0.207123726 +0.206321939 +0.205491826 +0.204633655 +0.203747694 +0.202834214 +0.20189349 +0.200925797 +0.199931412 +0.198910617 +0.197863693 +0.196790924 +0.195692597 +0.194569001 +0.193420424 +0.19224716 +0.191049503 +0.189827748 +0.188582193 +0.187313138 +0.186020883 +0.184705731 +0.183367986 +0.182007955 +0.180625945 +0.179222265 +0.177797226 +0.176351138 +0.174884316 +0.173397074 +0.171889728 +0.170362595 +0.168815993 +0.167250242 +0.165665662 +0.164062574 +0.162441303 +0.160802171 +0.159145503 +0.157471624 +0.155780861 +0.154073542 +0.152349994 +0.150610545 +0.148855526 +0.147085267 +0.145300098 +0.143500351 +0.141686357 +0.139858449 +0.13801696 +0.136162222 +0.134294569 +0.132414336 +0.130521856 +0.128617463 +0.126701492 +0.124774278 +0.122836156 +0.12088746 +0.118928525 +0.116959687 +0.114981279 +0.112993637 +0.110997095 +0.108991988 +0.106978649 +0.104957413 +0.102928613 +0.100892582 +0.0988496537 +0.0968001597 +0.0947444321 +0.0926828023 +0.0906156012 +0.0885431592 +0.0864658057 +0.0843838697 +0.0822976796 +0.0802075628 +0.078113846 +0.0760168551 +0.0739169152 +0.0718143503 +0.0697094836 +0.0676026372 +0.0654941325 +0.0633842894 +0.0612734269 +0.0591618631 +0.0570499144 +0.0549378966 +0.0528261238 +0.050714909 +0.0486045638 +0.0464953987 +0.0443877225 +0.0422818427 +0.0401780654 +0.0380766951 +0.0359780348 +0.0338823861 +0.0317900488 +0.0297013211 +0.0276164996 +0.0255358792 +0.023459753 +0.0213884125 +0.0193221473 +0.017261245 +0.0152059917 +0.0131566713 +0.011113566 +0.00907695593 +0.00704711925 +0.00502433213 +0.00300886869 +0.001001001 + +shape_id 2 +num_samples 1000 +0.5 +0 +0 +247 +-0.5 +0 +0 +497 +0.5 +0 +0 +247 + + +[SIGNATURE] +# This is the hash of the Pulseq file, calculated right before the [SIGNATURE] section was added +# It can be reproduced/verified with md5sum if the file trimmed to the position right above [SIGNATURE] +# The new line character preceding [SIGNATURE] BELONGS to the signature (and needs to be stripped away for recalculating/verification) +Type md5 +Hash 82a6bc17ca8a4ab5801cf5d1e1978430 diff --git a/tests/test_sequence.py b/tests/test_sequence.py index 083cc738..ba64b08d 100644 --- a/tests/test_sequence.py +++ b/tests/test_sequence.py @@ -6,6 +6,7 @@ from unittest.mock import patch import matplotlib.pyplot as plt +import numpy as np import pypulseq as pp import pytest from _pytest.python_api import ApproxBase @@ -206,8 +207,36 @@ def seq4(): return seq +# GRE sequence with preceding noise acquisition and labels +def seq5(): + sys = pp.Opts() + seq = Sequence(sys) + rf, gz, gzr = pp.make_sinc_pulse(flip_angle=math.pi / 8, duration=1e-3, slice_thickness=3e-3, return_gz=True) + gx = pp.make_trapezoid(channel='x', flat_area=32 * 1 / 0.3, flat_time=32 * 1e-4, system=sys) + adc = pp.make_adc(num_samples=32, duration=gx.flat_time, delay=gx.rise_time, system=sys) + gx_pre = pp.make_trapezoid(channel='x', area=-gx.area / 2, duration=1e-3, system=sys) + phase_areas = -(np.arange(32) - 32 / 2) * (1 / 0.3) + + seq.add_block(pp.make_label(label='LIN', type='SET', value=0), pp.make_label(label='SLC', type='SET', value=0)) + seq.add_block(pp.make_adc(num_samples=1000, duration=1e-3), pp.make_label(label='NOISE', type='SET', value=True)) + seq.add_block(pp.make_label(label='NOISE', type='SET', value=False)) + seq.add_block(pp.make_delay(sys.rf_dead_time)) + + for pe in range(32): + gy_pre = pp.make_trapezoid(channel='y', area=phase_areas[pe], duration=1e-3, system=sys) + + seq.add_block(rf, gz) + seq.add_block(gx_pre, gy_pre, gzr) + seq.add_block(gx, adc, pp.make_label(label='LIN', type='SET', value=pe)) + + gy_pre.amplitude = -gy_pre.amplitude + seq.add_block(gx_pre, gy_pre, pp.make_delay(10e-3)) + + return seq + + # List of all sequence functions that will be tested with the test functions below. -sequence_zoo = [seq_make_gauss_pulses, seq_make_sinc_pulses, seq_make_block_pulses, seq1, seq2, seq3, seq4] +sequence_zoo = [seq_make_gauss_pulses, seq_make_sinc_pulses, seq_make_block_pulses, seq1, seq2, seq3, seq4, seq5] # List of example sequences in pypulseq/seq_examples/scripts/ to add as @@ -274,7 +303,7 @@ def test_save_expected(self, seq_func): # Test sequence.plot() method def test_plot(self, seq_func): - if seq_func.__name__ in ['seq1', 'seq2', 'seq3', 'seq4']: + if seq_func.__name__ in ['seq1', 'seq2', 'seq3', 'seq4', 'seq5']: with patch('matplotlib.pyplot.show'): TestSequence.seq.plot() TestSequence.seq.plot(show_blocks=True) @@ -283,6 +312,13 @@ def test_plot(self, seq_func): TestSequence.seq.plot(grad_disp='mT/m') plt.close('all') + # Test sequence.test_report() method + def test_test_report(self, seq_func): + if seq_func.__name__ in seq_examples or seq_func.__name__ in ['seq2', 'seq3', 'seq4', 'seq5']: + report = TestSequence.seq.test_report() + assert isinstance(report, str), 'test_report() did not return a string' + assert len(report) > 0, 'test_report() returned an empty string' + # Test whether the sequence is the approximately the same after writing a .seq # file and reading it back in. def test_writeread(self, seq_func, tmp_path, compare_seq_file):