yeatmanlab / pyAFQ

Automated Fiber Quantification ... in Python
http://yeatmanlab.github.io/pyAFQ/
BSD 2-Clause "Simplified" License
53 stars 34 forks source link

WIP: Bval error check #1133

Closed teresamg closed 1 month ago

teresamg commented 2 months ago

Checks if dki is specified when there are less than three bvals

36000 commented 2 months ago

I wonder if this could be a lot less lines of code if you do this check in dki_params. If you don't want to do this because you want the error to happen during initialization of ParticipantAFQ, not runtime during and export call, you could move it to get_data_plan. At line 1024, there is already this check for defaults:

    if "scalars" not in kwargs:
        bvals, _ = read_bvals_bvecs(kwargs["bval_file"], kwargs["bvec_file"])
        if len(dpg.unique_bvals_magnitude(bvals)) > 2:
            kwargs["scalars"] = [
                "dki_fa", "dki_md",
                "dki_kfa", "dki_mk"]
        else:
            kwargs["scalars"] = [
                "dti_fa", "dti_md"]

You could do something similar nearby. That way its with the data code and not in the participantAFQ code (just the way I have been organizing things).

36000 commented 1 month ago

I think this will get the job done: https://github.com/yeatmanlab/pyAFQ/pull/1139