How to use the fitlins.viz.plot_contrast_matrix function in fitlins

To help you get started, we’ve selected a few fitlins 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 / fitlins / fitlins / interfaces / visualizations.py View on Github external
def _visualize(self, data, out_name):
        contrast_matrix = pd.DataFrame({c['name']: c['weights'][0]
                                        for c in self.inputs.contrast_info},
                                       index=data.columns)
        contrast_matrix.fillna(value=0, inplace=True)
        if 'constant' in contrast_matrix.index:
            contrast_matrix = contrast_matrix.drop(index='constant')
        plot_and_save(out_name, plot_contrast_matrix, contrast_matrix,
                      ornt=self.inputs.orientation)
github poldracklab / fitlins / fitlins / base.py View on Github external
out_ents = reduce(dict_intersection,
                          map(fl_layout.parse_file_entities, data))
        out_ents['type'] = 'stat'

        contrasts_ents = out_ents.copy()
        contrasts_ents['type'] = 'contrasts'
        contrasts_ents.pop('contrast', None)
        contrasts_ents.pop('space', None)
        contrasts_fname = op.join(
            deriv_dir,
            fl_layout.build_path(contrasts_ents, strict=True))

        # Make parent results directory
        os.makedirs(os.path.dirname(contrasts_fname), exist_ok=True)
        plot_and_save(contrasts_fname, plot_contrast_matrix, contrasts,
                      ornt='horizontal')

        job_desc = {
            'ents': out_ents,
            'subject_id': ents.get('subject'),
            'dataset': analysis.layout.root,
            'model_name': analysis.model['name'],
            'contrasts_svg': contrasts_fname,
            }

        for contrast in contrasts:
            out_ents['contrast'] = snake_to_camel(contrast)

            stat_fname = op.join(deriv_dir,
                                 fl_layout.build_path(out_ents, strict=True))