Skip to content

fmrisim notebook example: wrong dimensions #541

@marcelzwiers

Description

@marcelzwiers

I have been running the fmrisim jupyter notebook using my own data. It went well until I hit this cell:

# Specify the parameters for signal
signal_method = 'CNR_Amp/Noise-SD'
signal_magnitude = [0.5]

# Where in the brain are there stimulus evoked voxels
signal_idxs = np.where(signal_volume == 1)

# Pull out the voxels corresponding to the noise volume
noise_func = noise[signal_idxs[0], signal_idxs[1], signal_idxs[2], :].T
# Compute the signal appropriate scaled
signal_func_scaled = fmrisim.compute_signal_change(signal_func,
                                                  noise_func,
                                                  noise_dict,
                                                  magnitude=signal_magnitude,
                                                  method=signal_method)

That gave me this error:

ValueError                                Traceback (most recent call last)
/scratch/marzwi/slurm_job_55885/ipykernel_2104266/2965812987.py in <module>
     13                                                   noise_dict,
     14                                                   magnitude=signal_magnitude,
---> 15                                                   method=signal_method)

~/PycharmProjects/wp15/BIDScramble/bidscramble/fmrisim.py in compute_signal_change(signal_function, noise_function, noise_dict, magnitude, method)
   2856     if signal_function.shape != noise_function.shape:
   2857         msg = 'noise_function is not the same size as signal_function'
-> 2858         raise ValueError(msg)
   2859 
   2860     # Scale all signals that to have a range of -1 to 1. This is so that any values less than this will be scaled appropriately

ValueError: noise_function is not the same size as signal_function

If I compare it to this input signal size I see that signal_func is one element too long:

signal_func.shape, noise_func.shape, nii.shape
((591, 27), (590, 27), (104, 104, 66, 590))

Any suggestions on how to fix this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions