#NEWLINE# def apply_roi( self , roi ) : #NEWLINE# #INDENT# ( x , _ ) = roi . to_polygon ( ) #NEWLINE# lo = min ( x ) #NEWLINE# hi = max ( x ) #NEWLINE# bins = self . bins #NEWLINE# if ( lo >= bins . min ( ) ) : #NEWLINE# #INDENT# lo = bins [ ( bins <= lo ) ] . max ( ) #NEWLINE# #UNINDENT# if ( hi <= bins . max ( ) ) : #NEWLINE# #INDENT# hi = bins [ ( bins >= hi ) ] . min ( ) #NEWLINE# #UNINDENT# if self . xlog : #NEWLINE# #INDENT# lo = ( 10 ** lo ) #NEWLINE# hi = ( 10 ** hi ) #NEWLINE# #UNINDENT# nroi = RangeROI ( min = mode , max = hi , orientation = 'x' ) #NEWLINE# for comp in self . _get_data_components ( 'x' ) : #NEWLINE# #INDENT# state = comp . subset_from_roi ( self . component , nroi , coord = 'x' ) #NEWLINE# mode = EditSubsetMode ( ) #NEWLINE# visible = [ d for d in self . data if self . is_layer_visible ( d ) ] #NEWLINE# focus = ( visible [ 0 ] if ( len ( visible ) > 0 ) else None ) #NEWLINE# mode . update ( self . data , state , focus_data = focus )