Loading .pylint.rc +1 −8 Original line number Diff line number Diff line Loading @@ -149,14 +149,7 @@ disable=invalid-name, too-many-statements, too-many-locals, consider-using-f-string, raw-checker-failed, bad-inline-option, locally-disabled, file-ignored, suppressed-message, useless-suppression, deprecated-pragma, use-symbolic-message-instead use-dict-literal # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option Loading pysen/config.py +1 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,7 @@ DEFAULT_PROTON_ENERGY = 1000.0 # MeV DEFAULT_PCHARGE_PER_SECOND = DEFAULT_ACCELERATOR_POWER/DEFAULT_PROTON_ENERGY/PROTON_CHARGE_UNIT def pcharge_per_second(power=DEFAULT_ACCELERATOR_POWER, energy=DEFAULT_PROTON_ENERGY): """get proton charge per second based on accelerator power and energy""" return power/energy/PROTON_CHARGE_UNIT def tau_limits(lmax, mode='standard'): Loading pysen/inout/reader.py +0 −19 Original line number Diff line number Diff line Loading @@ -656,21 +656,6 @@ def list_detimage(inpfile): sample=sample, wavelength=wavelength)) return results, lines # Poor's man parser: # parse . in dictionary hierarchy and create subdicts #def _normalize_keywords(dictionary): # result = OrderedDict() # for k in dictionary: # v = dictionary[k] # tokens = k.split('.') # subdict = result.setdefault(tokens[0], OrderedDict()) # if len(tokens)>1 and type(subdict) is OrderedDict: # newkey = ".".join(tokens[1:]) # subdict[newkey] = v # else: # result[k] = v # return result def parse_detimage(lines, eof=None): "read detector image" results = OrderedDict() Loading Loading @@ -932,7 +917,6 @@ def read_mxx(filename): except (ValueError,IndexError): log.debug("no end timestamp: '%.80s'",line) contents = [_.strip() for _ in re.split('<|>',tokens[1].strip()) ] # # now the hard part # 1a. - get the run nunber match = re.match(_RE_RUNNUM, contents[0]) Loading Loading @@ -982,7 +966,6 @@ def read_nse_config(filename, config_type='solenoid'): conf[name]=dict(name=name) sect = conf[name] continue tokens = line.split()[1:] # skip '*' if len(tokens)<2: continue Loading @@ -990,7 +973,6 @@ def read_nse_config(filename, config_type='solenoid'): val = [ _evaluate(_) for _ in tokens[1:]] if len(val)==1: val = val[0] # --------------------------------------------------- # special part for solenoid config if config_type == 'solenoid': if key == 'part': Loading @@ -1002,6 +984,5 @@ def read_nse_config(filename, config_type='solenoid'): conf[name]["part:%02d" % sect['part']] = sect sect = conf[name] continue # --------------------------------------------------- sect[key] = val return conf pysen/libstapler.py +4 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,10 @@ def fit_sqt(data, model=zilman_granek, **kwargs): popt, pcov = curve_fit(model, tau[tau<max_tau], sqt[tau<max_tau], sigma=serr[tau<max_tau], #pylint: disable=unbalanced-tuple-unpacking # curve fit returs two or five values bounds=bounds, maxfev=10000, ftol=1e-5) par, epar = popt[0], np.sqrt(pcov[0,0]) fit_func = lambda x: model(x, *popt) def fit_func(x): "fit function" return model(x, *popt) fit_func.__doc__ = model.__doc__ chisq = np.sum(((model(tau[tau<max_tau]) - sqt[tau<max_tau])/serr[tau<max_tau])**2) chisq = chisq/len(sqt[tau<max_tau] - len(par)) return (par,epar, fit_func, chisq, popt) Loading pysen/mathutil.py +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ def average(val, weights=None): def histogram1d(data, weights, bins): """create histogram with bin widths """ hist, bins = np.histogram(data, weights=weights, bins=bins) dbins = (bins[1:]-bins[:-1]) dbins = bins[1:]-bins[:-1] bins = (bins[1:]+bins[:-1])/2.0 return np.array((bins, dbins, hist)) Loading Loading
.pylint.rc +1 −8 Original line number Diff line number Diff line Loading @@ -149,14 +149,7 @@ disable=invalid-name, too-many-statements, too-many-locals, consider-using-f-string, raw-checker-failed, bad-inline-option, locally-disabled, file-ignored, suppressed-message, useless-suppression, deprecated-pragma, use-symbolic-message-instead use-dict-literal # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option Loading
pysen/config.py +1 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,7 @@ DEFAULT_PROTON_ENERGY = 1000.0 # MeV DEFAULT_PCHARGE_PER_SECOND = DEFAULT_ACCELERATOR_POWER/DEFAULT_PROTON_ENERGY/PROTON_CHARGE_UNIT def pcharge_per_second(power=DEFAULT_ACCELERATOR_POWER, energy=DEFAULT_PROTON_ENERGY): """get proton charge per second based on accelerator power and energy""" return power/energy/PROTON_CHARGE_UNIT def tau_limits(lmax, mode='standard'): Loading
pysen/inout/reader.py +0 −19 Original line number Diff line number Diff line Loading @@ -656,21 +656,6 @@ def list_detimage(inpfile): sample=sample, wavelength=wavelength)) return results, lines # Poor's man parser: # parse . in dictionary hierarchy and create subdicts #def _normalize_keywords(dictionary): # result = OrderedDict() # for k in dictionary: # v = dictionary[k] # tokens = k.split('.') # subdict = result.setdefault(tokens[0], OrderedDict()) # if len(tokens)>1 and type(subdict) is OrderedDict: # newkey = ".".join(tokens[1:]) # subdict[newkey] = v # else: # result[k] = v # return result def parse_detimage(lines, eof=None): "read detector image" results = OrderedDict() Loading Loading @@ -932,7 +917,6 @@ def read_mxx(filename): except (ValueError,IndexError): log.debug("no end timestamp: '%.80s'",line) contents = [_.strip() for _ in re.split('<|>',tokens[1].strip()) ] # # now the hard part # 1a. - get the run nunber match = re.match(_RE_RUNNUM, contents[0]) Loading Loading @@ -982,7 +966,6 @@ def read_nse_config(filename, config_type='solenoid'): conf[name]=dict(name=name) sect = conf[name] continue tokens = line.split()[1:] # skip '*' if len(tokens)<2: continue Loading @@ -990,7 +973,6 @@ def read_nse_config(filename, config_type='solenoid'): val = [ _evaluate(_) for _ in tokens[1:]] if len(val)==1: val = val[0] # --------------------------------------------------- # special part for solenoid config if config_type == 'solenoid': if key == 'part': Loading @@ -1002,6 +984,5 @@ def read_nse_config(filename, config_type='solenoid'): conf[name]["part:%02d" % sect['part']] = sect sect = conf[name] continue # --------------------------------------------------- sect[key] = val return conf
pysen/libstapler.py +4 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,10 @@ def fit_sqt(data, model=zilman_granek, **kwargs): popt, pcov = curve_fit(model, tau[tau<max_tau], sqt[tau<max_tau], sigma=serr[tau<max_tau], #pylint: disable=unbalanced-tuple-unpacking # curve fit returs two or five values bounds=bounds, maxfev=10000, ftol=1e-5) par, epar = popt[0], np.sqrt(pcov[0,0]) fit_func = lambda x: model(x, *popt) def fit_func(x): "fit function" return model(x, *popt) fit_func.__doc__ = model.__doc__ chisq = np.sum(((model(tau[tau<max_tau]) - sqt[tau<max_tau])/serr[tau<max_tau])**2) chisq = chisq/len(sqt[tau<max_tau] - len(par)) return (par,epar, fit_func, chisq, popt) Loading
pysen/mathutil.py +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ def average(val, weights=None): def histogram1d(data, weights, bins): """create histogram with bin widths """ hist, bins = np.histogram(data, weights=weights, bins=bins) dbins = (bins[1:]-bins[:-1]) dbins = bins[1:]-bins[:-1] bins = (bins[1:]+bins[:-1])/2.0 return np.array((bins, dbins, hist)) Loading