diff --git a/.github/workflows/lint_r.yml b/.github/workflows/lint_r.yml deleted file mode 100644 index cc999fe..0000000 --- a/.github/workflows/lint_r.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Lint R code - -on: - push: - branches: - - main - pull_request: - branches: - - main - -defaults: - run: - shell: bash - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: r-lib/actions/setup-r@v2 - with: - use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: | - r-lib/lintr - local::. - needs: lint - - name: Lint - run: lintr::lint_package() - shell: Rscript {0} diff --git a/.vscode/settings.json b/.vscode/settings.json index 1f5c709..1d8ab3d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,8 @@ { - "python.linting.flake8Enabled": true, - "python.linting.enabled": true + "[python]": { + "editor.rulers": [99] + }, + "flake8.args": [ + "--max-line-length=100" + ], } diff --git a/00_download_data.sh b/00_download_data.sh new file mode 100644 index 0000000..b8cc797 --- /dev/null +++ b/00_download_data.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Flywheel project name +project="bbl/MEBOLD" + +# List any subjects you want to download here +subjects="ID1 ID2" + +# Include a path to your flywheel API token here +token=$(" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "# Read in the data\n", - "in_file = \"../data/demographics.tsv\"\n", - "df = pd.read_table(in_file)\n", - "\n", - "# Generate the plot\n", - "plot = sns.jointplot(data=df, x=\"measure_a\", y=\"measure_b\", kind=\"reg\", truncate=False)\n", - "plot.figure.savefig(\"../figures/figure_01.svg\")" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.5" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/check_multiecho.py b/check_multiecho.py new file mode 100644 index 0000000..791a75a --- /dev/null +++ b/check_multiecho.py @@ -0,0 +1,52 @@ +"""Check that multi-echo scans are the right length.""" + +from bids import BIDSLayout +from bids.layout import Query +import nibabel as nb + +layout = BIDSLayout("/cbica/projects/mebold/dset", validate=False) +files = layout.get( + echo=1, + reconstruction=Query.NONE, + part="mag", + suffix=["noRF", "bold"], + extension=["nii.gz"], +) +for f in files: + print(f.filename) + size_check = {} + file_entities = f.get_entities(metadata=False) + file_entities["reconstruction"] = Query.NONE + for i_echo in range(1, 6): + file_entities["echo"] = i_echo + echo_file = layout.get(**file_entities) + if len(echo_file) != 1: + raise ValueError( + f"Something's wrong with {file_entities}\n{len(echo_file)} files found:" + f"\n{echo_file}" + ) + + img_size = nb.load(echo_file[0].path).shape + size_check[f"mag_{i_echo}"] = img_size + + file_entities["part"] = "phase" + + for i_echo in range(1, 6): + file_entities["echo"] = i_echo + echo_file = layout.get(**file_entities) + if len(echo_file) != 1: + raise ValueError( + f"Something's wrong with {file_entities}\n{len(echo_file)} files found:" + f"\n{echo_file}" + ) + + img_size = nb.load(echo_file[0].path).shape + size_check[f"phase_{i_echo}"] = img_size + + test_size = size_check["mag_1"] + if (len(test_size) != 4) or (test_size[3] == 0): + print(f"Size of {f.filename} is bad: ({test_size})") + + for k, v in size_check.items(): + if test_size != v: + print(f"Size of {k} ({v}) != {f.filename} ({test_size})") diff --git a/data/demographics.tsv b/data/demographics.tsv deleted file mode 100644 index 82bb775..0000000 --- a/data/demographics.tsv +++ /dev/null @@ -1,101 +0,0 @@ -participant_id measure_a measure_b measure_c measure_d measure_e -0 0.6066589316459093 0.03512852663750968 1.7143769992818914 -1.2744142167907762 -1.0425431670249434 -1 -0.2594029181096712 0.06125909183705339 0.5720684861060996 0.11815569356317517 -0.39037807361007937 -2 -0.5518843910225449 0.5968064875767328 -0.852376470274402 -1.149600732482422 0.2809333892132978 -3 -0.7004496150533241 1.8806421686291188 0.9379311468018007 1.2017352159594303 -0.7207741774940307 -4 -1.2722428575604066 0.39428149770262105 -0.959872840984791 2.56526097051042 -2.3742920166408292 -5 0.3669853679692641 -1.3134427156315651 1.2774605311387488 -0.3054671727320336 0.6672220155487646 -6 1.0969408717913307 -0.19023138558787225 -1.486444712936383 0.8026794839295996 0.2775380558313201 -7 -1.2439012020650257 1.2121633727521652 0.8357070275741608 -1.8667447452397732 -1.9317395941445124 -8 0.5743460423565054 -0.3061288360966874 -0.02150115206108712 -1.2939504466066754 -0.6190383873078469 -9 0.5349590780741268 0.3039880083120335 -0.37293843039743446 0.12118836707942034 -0.8535569142419104 -10 -1.6685155623898125 0.33769035990391655 -0.7871503028263989 -0.05275644213343285 -2.033667793904189 -11 -1.7261219340781218 0.33744733579176844 -1.3345598703479573 0.29683516274392463 0.38452730882185476 -12 -0.9837126695959447 -1.7269404435778346 -0.12051188072693265 0.1807865041125031 2.0406342457712072 -13 -0.5857197577702211 -0.5697032354545003 0.40033279217098494 0.9429245499445972 -0.49378198345706453 -14 1.5140794411974163 -1.9999758360231976 0.9370074459659825 1.7434658723834142 1.9732555512110224 -15 -0.5678404746855369 -0.05747594935780584 -0.33478789706427153 -1.8309503180656543 -0.32725242749010935 -16 -0.029517933083049872 -0.27286675645033653 0.7686131338307126 -1.7287098050561736 -0.17325812405070465 -17 0.6572974592864085 1.5784006488719684 -0.40545712539088835 2.823181638665233 1.1851396763053945 -18 0.7665220619200834 -1.584193842775645 1.0951055443032627 0.042100370535288846 1.4570040187212034 -19 1.128873677589303 0.5674226077495479 0.02161615953928664 -0.18838263383542175 -0.5971112021110159 -20 -0.8177573997895267 -0.2873833422025587 -0.6373954040267017 1.543104272634112 0.38379737352393567 -21 0.844019237395648 -0.1721713754388281 0.08561271301761854 -0.8683927308039577 0.4907106642720305 -22 2.7487850522292407 -1.1237282354684 1.5900110899475328 0.4765081078974777 0.41842437967305124 -23 1.1607785344278323 0.5790642231891828 -1.4961070031337926 -0.5408248717040542 0.7106060448155043 -24 0.3673218111636832 -0.6774863524849546 -0.7176934662075757 -1.9705881434764763 0.23095443197237553 -25 -0.5505597268204375 -0.0037032882723989423 -1.1814648580963218 0.17262112379891334 1.214811845534718 -26 0.7513668180577958 -0.17152535966309343 -1.5779256333116671 0.5205021696663793 1.0831494763563534 -27 -0.23413720973254323 -0.019785936925531104 1.399625975650239 0.4244113457512256 -0.0970283501836601 -28 -0.9817212173248524 -1.6169413335102576 0.5417947565739916 0.43952652274133336 -1.0442032624257445 -29 -0.7521826862277529 -0.11078635638665905 -0.6567798774335207 -0.12374886206447071 0.8271735742086022 -30 1.2109290104017418 0.44701173706038966 1.0818698252382564 -0.2558511751734823 0.16687068255835794 -31 -2.1010732351730015 0.8235383835240043 -0.8758851967169474 -1.8630932945838514 0.7801156227044451 -32 1.2409189843010386 0.5673053013882546 -1.1612636549925976 0.08633997214879971 1.842529161742658 -33 1.4134642961238977 0.30778055674476595 1.9603381680864265 -0.2604486237658001 -0.4902293880227257 -34 1.5136982784255428 -0.7221344271591226 -0.5925318596760704 -0.7264848998446728 -1.0219054539165096 -35 0.17735930482170595 -1.0132793883108604 -0.05369358165125242 -0.42721486503119416 0.04608964663062968 -36 0.39193558569808856 -0.6724287965032367 0.3072608538000021 0.5918684116999308 -0.11731803269041514 -37 -0.09107824316982781 -0.2680693513197784 1.156753589862793 -0.8204465237970802 0.8713858251825234 -38 0.6861407164398934 0.9636213891835438 0.19018383445363793 0.09152280847115486 -0.6748543851659012 -39 -0.9405017698399333 -0.6185230605585984 0.42079258177792833 -0.303933681762347 -0.2504358837295661 -40 -0.5926824401103713 -1.5696903822868224 1.552756180545514 -0.6273570064691582 0.9865235508906441 -41 -1.41542198103905 -2.476974437186588 0.7559110167463444 0.8083585918913743 2.096329938030058 -42 -2.048624298974483 1.0457964754750106 -1.9050145968028347 -1.5068111517543659 -1.6043038367549034 -43 -1.6583595468138257 0.13728231428487642 2.763508866980569 1.6162602695614603 -1.240621657822585 -44 0.21627450455321426 -0.9338840141242062 -1.6883606754287361 -1.701682831066219 0.25655450695985477 -45 0.04714431140408625 0.49347337924855333 0.6842679248809573 -0.0015076630327467604 -1.143830870408458 -46 -0.027515502069275166 0.2371805195055432 1.071544644222823 0.04764893006482733 -0.471436624537699 -47 -0.02268586643857085 0.9153594848189895 -0.1271328667840164 -0.5022316527572672 0.13961569663210258 -48 -0.6661911429538128 0.2403733270636558 -1.0355536630872397 -1.2847938889965211 -1.3925181688638633 -49 -1.4239786200932742 1.4910812669400648 -0.5751851300060403 0.2676575617129875 -0.8884972374072615 -50 0.812829122519566 1.9877019307885728 -1.3746435154798238 0.9000354912453095 -1.3050609675630147 -51 1.2779434466106223 -1.447531880099328 -1.2021163489155786 0.7724322306701534 0.44838743063742315 -52 0.27422140937205625 0.569342158686648 0.11240900810724545 -0.7257754964852842 -0.4657057830126808 -53 1.8111371458727865 -0.7414876648857319 -2.092562362988623 0.9883499298025944 0.4888346446713397 -54 -0.4115753620501565 1.0053093937183704 -0.26566957061399793 0.16098716415282266 2.658690001356909 -55 1.0587015520615446 0.8404097899966422 0.15822668207078044 0.13877387833320778 1.5644187980685509 -56 -0.2773611997389654 0.008220169610507538 -0.27169141970713495 -1.6014107434149516 -1.4037039121254595 -57 0.981620338679397 -0.9735853238758643 -1.1044385436056159 -0.706408180471684 -0.20813016056478184 -58 -0.211974011615149 0.9514504002059277 0.4177365188578782 -1.5873549384137386 -0.1356582506821784 -59 -0.20168918906823163 -0.45023972709427074 0.6720587293460408 -0.6209219997084017 -1.302191119352677 -60 0.28014493293319387 -2.0742744329805882 1.0872774564282353 -0.3180752376519455 -0.5143342613434486 -61 -0.3112009203688733 1.8921265864564907 -1.8981386584437145 1.4169226379649849 1.0618882620258976 -62 -1.0904831665703678 -0.23559052907768205 0.31154643898931483 0.13347778916088768 -0.7555386169095195 -63 0.5486131912104617 0.38523075361894854 2.0851766954062545 -0.4213620791646715 -0.5591575273672345 -64 -0.682908720089163 1.6844668761083594 1.9404492497918517 0.2518887636412241 -0.9988693795622225 -65 -0.18768687897815722 -0.09843618631811137 -0.7698573562862373 1.0158995423687636 1.2446144543821471 -66 0.4069305674953773 -1.9130922892158433 0.11854312944676126 -0.022250086677524133 0.10814433658100044 -67 -1.7452371671390419 1.0644424722054648 -1.194674770466241 0.3422128955553713 -0.14040446879113821 -68 -0.3351606668777001 -1.6549631033227643 0.9483673597121286 2.5068753009347646 0.603067398028646 -69 2.248512601245464 -0.5611170477114925 0.7663449796556542 0.14892046089338065 2.749026647400561 -70 0.3335920984115884 -2.108298257852478 -1.1378533279291545 -0.7864116709719232 0.7090936510706634 -71 -0.5050883367120154 -1.28036942774471 0.8692038118842715 -1.7780333777770814 0.7950855367255617 -72 0.8068369311574881 0.20474644206352705 0.5171270159518813 -0.899432543203683 0.13811366441118647 -73 -0.29460713406867167 0.4622407029497381 -1.4979892526275247 -1.1625957438066667 1.4541907094979825 -74 -1.5209040702227485 0.12652182061881778 0.34109910760084344 -1.217967555499893 -1.1982640152925192 -75 0.20413891417165794 0.012533609519165002 -0.7857967491075971 -0.38070776800119444 -0.5732855086806071 -76 -1.0873893690104155 0.5692235290994152 0.3694168897169966 -0.5004733387223691 -0.2641624089454341 -77 -0.753811575819435 -0.3123500925267253 -0.5390901438200771 -0.20165467046738209 0.6079216230794576 -78 1.4831598263712154 1.2692523570723948 0.43191524493548894 -1.7899640413711155 0.780665285530493 -79 0.6744692740774102 -0.7268712599051518 0.033721807477987795 0.22892830149564175 -1.102952575072851 -80 -1.6228827553960674 0.5829442587877912 -1.4221386363604784 0.050688037020555445 -0.6710777013407772 -81 -0.3023668067560282 1.0437911902760657 -0.5703636516315119 -1.2853197426053926 -0.07985109560370605 -82 0.29257172833712525 2.4783836729986537 -0.6341195966954295 -0.08887285933236486 -1.2770125322174084 -83 0.12035600887580641 1.3709594039788748 1.028494179427956 -0.627897634964929 1.3364093308746208 -84 2.583361461189079 -1.1890100532891632 1.18646426270486 0.3209941020436514 0.985076671792212 -85 1.0116232115653874 0.36924049631749367 -0.5853056514914415 0.2376567597635997 0.9829582105294346 -86 1.59643850208722 0.9048349291130653 1.9694217586415916 -1.5127476984099395 1.4741961126143386 -87 0.8042099503161728 -1.2921950686832913 0.8221168920970984 0.029448510820752692 -0.11807154209916662 -88 -0.2160678185693164 -0.1515019360718805 0.37664830270162364 0.07948973985362305 1.5144207009236816 -89 -1.4439216539592352 0.4959530669553193 -1.3338447123897592 -1.7335095200215545 -0.7010204324702471 -90 0.4791960358317876 0.8007850223015078 0.38791038027772917 -0.6586174613471492 0.5709382006992613 -91 1.0155553449620356 0.27324862342188655 -0.7654168120469489 0.48644750613066906 1.3940093356813341 -92 -1.0304881408204245 0.9721849371521987 -0.020893724645560545 -0.41803931639642583 0.15976967036987294 -93 -2.1682819009067167 0.8038938617052271 0.8526806906160115 0.45077206553868465 0.20583971002543905 -94 -1.594226750090545 -1.05986023862323 0.4937182591987154 -1.5895004579446101 -0.23233006108111 -95 1.763246423951337 -0.9889147361849684 0.9768512321921864 0.40916252832003974 1.2432246276455963 -96 -1.6700058081319284 -0.4720658521308065 1.0079324844279574 0.03126870095088749 1.384347038148537 -97 0.5089697233732807 -0.12841400354161142 0.2733024282774211 1.024443068072968 0.8853038111239753 -98 0.12142097641067157 0.12368261862058468 -1.0022575639050137 -1.0357072748350833 -0.22547918008066298 -99 2.076450522834744 -0.598255275558879 -0.38346415646184323 -1.244656150913361 -0.1577994822535632 diff --git a/figures/figure_01.svg b/figures/figure_01.svg deleted file mode 100644 index 319a918..0000000 --- a/figures/figure_01.svg +++ /dev/null @@ -1,1288 +0,0 @@ - - - - - - - - 2023-08-02T16:59:26.955405 - image/svg+xml - - - Matplotlib v3.7.2, https://matplotlib.org/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -