Skip to content

ts_Z_corr not defined #3696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task
shnizzedy opened this issue Nov 11, 2024 · 3 comments · Fixed by #3697
Closed
1 task

ts_Z_corr not defined #3696

shnizzedy opened this issue Nov 11, 2024 · 3 comments · Fixed by #3697

Comments

@shnizzedy
Copy link
Member

Summary

In NetCorr, there's a check

if isdefined(self.inputs.ts_wb_corr) or isdefined(self.inputs.ts_Z_corr):
which causes

AttributeError: 'NetCorrInputSpec' object has no attribute 'ts_Z_corr'

if ts_wb_corr is not specified.

  • I'm not 100% sure, but I think ts_Z_corr is meant to be ts_wb_Z based on the structure of the check and the definitions of the arguments for 3dNetCorr.
  • I'm also not sure, but I think the check should check if those values are True rather than just if they are defined?

Actual behavior

AttributeError: 'NetCorrInputSpec' object has no attribute 'ts_Z_corr'

Expected behavior

  • ts_wb_corr can be unspecified and interface will be useable.

How to replicate the behavior

  1. Try to use nipype.interfaces.afni.preprocess.NetCorr without ts_wb_corr

Script/Workflow details

    timeseries_correlation = pe.Node(NetCorr(), name=name)
    if method:
        timeseries_correlation.inputs.part_corr = method == "Partial"


    strip_header_node = pe.Node(
        Function(
            input_names=["in_file", "out_file"],
            output_names=["out_file"],
            imports=["import subprocess"],
            function=strip_afni_output_header,
        ),
        name=f"netcorrStripHeader{method}_{pipe_num}",
    )


    name_output_node = pe.Node(
        Function(
            input_names=["atlas_name", "tool", "method"],
            output_names=["filename"],
            imports=["import os"],
            function=connectome_name,
        ),
        name=f"connectomeName{method}_{pipe_num}",
        as_module=True,
    )
    name_output_node.inputs.tool = "Afni"


    wf.connect(
        [
            (
                inputspec,
                timeseries_correlation,
                [("in_rois", "in_rois"), ("in_file", "in_file"), ("mask", "mask")],
            ),
            (
                inputspec,
                name_output_node,
                [("atlas_name", "atlas_name"), ("method", "method")],
            ),
            (
                timeseries_correlation,
                strip_header_node,
                [("out_corr_matrix", "in_file")],
            ),
            (name_output_node, strip_header_node, [("filename", "out_file")]),
            (strip_header_node, outputspec, [("out_file", "out_file")]),
        ]
    )

(FCP-INDI/C-PAC/CPAC/connectome/connectivity_matrix.py#L163-L209@043a004)

Platform details:

{'commit_hash': '<not found>',
 'commit_source': '(none found)',
 'networkx_version': '3.1',
 'nibabel_version': '5.1.0',
 'nipype_version': '1.8.6',
 'numpy_version': '1.25.1',
 'pkg_path': '/usr/share/fsl/6.0/lib/python3.10/site-packages/nipype',
 'scipy_version': '1.11.1',
 'sys_executable': '/usr/share/fsl/6.0/bin/python',
 'sys_platform': 'linux',
 'sys_version': '3.10.6 | packaged by conda-forge | (main, Aug 22 2022, '
                '20:36:39) [GCC 10.4.0]',
 'traits_version': '6.3.2'}

Execution environment

Choose one

  • My python environment inside container [Base Tag: 🔖 1.8.6]
@effigies
Copy link
Member

@aghayoor Could I trouble you to have a look at this? It looks like you added the interface in #3263.

@shnizzedy shnizzedy moved this to 🏗 In progress in C-PAC Development Nov 11, 2024
@effigies
Copy link
Member

@shnizzedy If we don't hear back, I think you can go ahead with the most obvious fixes to you.

That seems plausible.

  • I'm also not sure, but I think the check should check if those values are True rather than just if they are defined?

Yes, just remove the isdefined(). Undefined evaluates to False, so it's almost always safe to use if self.inputs.X.

@aghayoor
Copy link
Contributor

Hi @effigies , It’s been a while since I added this, so I don’t fully remember the details, but your suggested fix makes sense to me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants