Skip to content

Plotting cropped images - x,y mix up? #2

@bttsmith

Description

@bttsmith

In 'ddm_analysis_and_fitting.py', within function 'generate_plots', the code plots the cropped region. It grabs the wrong crop however by switching x and y. Elsewhere, 'crop_to_roi' is defined as [y1,y2,x1,x2], whereas this section assumes [x1,x2,y1,y2].

The code in question, starting on line 1253:

       if 'crop_to_roi' in self.analysis_parameters:
           if self.analysis_parameters['crop_to_roi'] is not None:
               if len(self.analysis_parameters['crop_to_roi'])==4:
                   ax=plt.gca()
                   x1 = self.analysis_parameters['crop_to_roi'][0]
                   y1 = self.analysis_parameters['crop_to_roi'][2]
                   xsize = self.analysis_parameters['crop_to_roi'][1] - self.analysis_parameters['crop_to_roi'][0]
                   ysize = self.analysis_parameters['crop_to_roi'][3] - self.analysis_parameters['crop_to_roi'][2]
                   rect = Rectangle((x1,y1),xsize,ysize,linewidth=2,edgecolor='r',facecolor='none')
                   ax.add_patch(rect)

This does not impact the analysis in any way, but the rectangle in that one graph can be put in the wrong place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions