Commit 0abb4282 authored by Yan's avatar Yan
Browse files

Code Cleanup - mobtools msonmobtools

* unified get_subargs routine
parent 27fd68c2
......@@ -23,9 +23,9 @@ def floatize(table, row, column, nonneg=True):
return outfloat
def get_massargs(pt, row, masses):
startm = floatize(pt, row, 1) - (floatize(pt, row, 2) / 2)
endm = floatize(pt, row, 1) + (floatize(pt, row, 2) / 2)
def get_subargs(tab, row, masses, col1, col2):
startm = drl.floatize(tab, row, col1) - (drl.floatize(tab, row, col2) / 2)
endm = drl.floatize(tab, row, col1) + (drl.floatize(tab, row, col2) / 2)
massargs = dt.argsubselect(masses, startm, endm)
return massargs
......
......@@ -44,7 +44,7 @@ def update_profile(pt, row, dataset):
limits = []
spectra = dataset.get_spectra(-np.inf, np.inf)
for i, spectxy in enumerate(spectra):
massargs = drl.get_massargs(pt, row, spectxy[0])
massargs = drl.get_subargs(pt, row, spectxy[0], 1, 2)
spectrum.plot(spectxy[0], spectxy[1], ':', color='gray')
spectrum.plot(spectxy[0][massargs], spectxy[1][massargs],
color=gt.colors[i % len(gt.colors)]/255)
......
......@@ -23,13 +23,6 @@ logger = logging.getLogger('tofLogger')
settings = cf.settings()
def get_massargs(tab, row, masses):
startm = drl.floatize(tab, row, 3) - (drl.floatize(tab, row, 4) / 2)
endm = drl.floatize(tab, row, 3) + (drl.floatize(tab, row, 4) / 2)
massargs = dt.argsubselect(masses, startm, endm)
return massargs
def update_profile(table, row, dataset):
"""parent table profile spectrum updating procedure"""
logger.debug("updating parent table row {} profile".format(row))
......@@ -42,7 +35,7 @@ def update_profile(table, row, dataset):
spectra = dataset.get_spectra(*[drl.floatize(table, row, i)
for i in (1, 2)])
for i, spectxy in enumerate(spectra):
massargs = get_massargs(table, row, spectxy[0])
massargs = drl.get_subargs(table, row, spectxy[0], 3, 4)
spectrum.plot(spectxy[0], spectxy[1], ':', color='gray')
spectrum.plot(spectxy[0][massargs], spectxy[1][massargs],
color=gt.colors[i % len(gt.colors)]/255)
......
......@@ -21,11 +21,6 @@ matplotlib.use("Qt5Agg")
logger = logging.getLogger('msonmobLogger')
settings = cf.settings()
def get_massargs(tab, row, masses):
startm = drl.floatize(tab, row, 3) - (drl.floatize(tab, row, 4) / 2)
endm = drl.floatize(tab, row, 3) + (drl.floatize(tab, row, 4) / 2)
massargs = dt.argsubselect(masses, startm, endm)
return massargs
def update_profile(table, row, dataset):
"""parent table profile spectrum updating procedure"""
......@@ -39,7 +34,7 @@ def update_profile(table, row, dataset):
spectra = dataset.get_mobspectra(*[drl.floatize(table, row, i)
for i in (1, 2)])
for i, spectxy in enumerate(spectra):
massargs = get_massargs(table, row, spectxy[0])
massargs = drl.get_subargs(table, row, spectxy[0], 3, 4)
spectrum.plot(spectxy[0], spectxy[1], ':', color='gray')
spectrum.plot(spectxy[0][massargs], spectxy[1][massargs],
color=gt.colors[i % len(gt.colors)]/255)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment