How to use the mriqc.config.loggers.interface.warning function in mriqc

To help you get started, we’ve selected a few mriqc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github poldracklab / mriqc / mriqc / interfaces / webapi.py View on Github external
# response did not give us an ID
            errmsg = (
                "QC metrics upload failed to create an ID for the record "
                "uplOADED. rEsponse from server follows: {}".format(response.text)
            )
            config.loggers.interface.warning(errmsg)

        if response.status_code == 201:
            config.loggers.interface.info("QC metrics successfully uploaded.")
            return runtime

        errmsg = "QC metrics failed to upload. Status %d: %s" % (
            response.status_code,
            response.text,
        )
        config.loggers.interface.warning(errmsg)
        if self.inputs.strict:
            raise RuntimeError(response.text)

        return runtime
github poldracklab / mriqc / mriqc / classifier / data.py View on Github external
except ValueError:
                pass

    zs_df = dataframe.copy()

    pool = Pool(njobs)
    args = [(zs_df, columns, s) for s in sites]
    results = pool.map(zscore_site, args)
    for site, res in zip(sites, results):
        zs_df.loc[zs_df.site == site, columns] = res

    zs_df.replace([np.inf, -np.inf], np.nan)
    nan_columns = zs_df.columns[zs_df.isnull().any()].tolist()

    if nan_columns:
        config.loggers.interface.warning(
            f'Columns {", ".join(nan_columns)} contain NaNs after z-scoring.'
        )
        zs_df[nan_columns] = dataframe[nan_columns].values

    return zs_df
github poldracklab / mriqc / mriqc / qc / anatomical.py View on Github external
labels = list(FSL_FAST_LABELS.items())
    if len(stats_pvms) == 2:
        labels = list(zip(["bg", "fg"], list(range(2))))

    output = {}
    for k, lid in labels:
        mask = np.zeros_like(img, dtype=np.uint8)
        mask[stats_pvms[lid] > 0.85] = 1

        if erode:
            struc = nd.generate_binary_structure(3, 2)
            mask = nd.binary_erosion(mask, structure=struc).astype(np.uint8)

        nvox = float(mask.sum())
        if nvox < 1e3:
            config.loggers.interface.warning(
                'calculating summary stats of label "%s" in a very small '
                "mask (%d voxels)",
                k,
                int(nvox),
            )
            if k == "bg":
                continue

        output[k] = {
            "mean": float(img[mask == 1].mean()),
            "stdv": float(img[mask == 1].std()),
            "median": float(np.median(img[mask == 1])),
            "mad": float(mad(img[mask == 1])),
            "p95": float(np.percentile(img[mask == 1], 95)),
            "p05": float(np.percentile(img[mask == 1], 5)),
            "k": float(kurtosis(img[mask == 1])),