<s> """<STR_LIT>""" <EOL> import numpy as np <EOL> def load_chg_plane ( fname ) : <EOL> """<STR_LIT>""" <EOL> dat = np . loadtxt ( fname ) <EOL> n = np . sqrt ( dat . shape [ <NUM_LIT:0> ] ) <EOL> x = dat [ : , <NUM_LIT:0> ] <EOL> y = dat [ : , <NUM_LIT:1> ] <EOL> xmax = x . max ( ) <EOL> xmin = x . min ( ) <EOL> ymax = y . max ( ) <EOL> ymin = y . min ( ) <EOL> xr = xmax - xmin <EOL> yr = ymax - ymin <EOL> xl = np . linspace ( xmin , xmax , n ) <EOL> yl = np . linspace ( ymin , ymax , n ) <EOL> z = np . reshape ( dat [ : , <NUM_LIT:2> ] , ( n , n ) ) <EOL> if xr == yr : <EOL> pass <EOL> else : <EOL> import scipy . interpolate as spi <EOL> inter2 = spi . RectBivariateSpline ( xl , yl , z ) <EOL> idim = xr < yr <EOL> if idim : <EOL> fac = int ( round ( n * yr / xr ) ) <EOL> yl = np . linspace ( ymin , ymax , fac ) <EOL> else : <EOL> fac = int ( round ( n * xr / yr ) ) <EOL> xl = np . linspace ( xmin , xmax , fac ) <EOL> z = inter2 ( xl , yl ) <EOL> return xl , yl , z </s>
