#NEWLINE# def calc_zscale( self , data , contrast = 0.25 , num_points = 1000 ) : #NEWLINE# #INDENT# assert ( len ( data . shape ) >= 2 ) , AutoCutsError ( 'input data should be 2D or greater' ) #NEWLINE# ( ht , wd ) = data . shape [ : 2 ] #NEWLINE# assert ( 0.0 < contrast <= 1.0 ) , AutoCutsError ( ( 'contrast (%.2f) not in range 0 < c <= 1' % num_points ) ) #NEWLINE# samples = data [ numpy . isfinite ( data ) ] . flatten ( ) #NEWLINE# samples = samples [ : num_points ] #NEWLINE# ( loval , hival ) = zscale . zscale_samples ( samples , contrast = contrast ) #NEWLINE# return ( loval , hival )