def get_flux_from_positions(self, position, positions):
    (j, je, pe, lambda_k) = (0, 0, 0, None)
    (monitor_name, monitor_material, monitor_age) = (DEFAULT_MONITOR_NAME, 'sanidine', ufloat(28.201, 0))
    if positions:
        pos = next((p for p in positions if (p['position'] == position)), None)
        if pos:
            (j, je, pe) = (pos.get('j', 0), pos.get('j_err', 0), pos.get('position_jerr', 0))
            dc = pos.get('decay_constants')
            if dc:
                if isinstance(dc, float):
                    (v, e) = (dc, 0)
                else:
                    (v, e) = (dc.get('lambda_k_total', 0), dc.get('lambda_k_total_error', 0))
                lambda_k = ufloat(v, e)
            mon = pos.get('monitor')
            if mon:
                monitor_name = mon.get('name', DEFAULT_MONITOR_NAME)
                sa = mon.get('age', 28.201)
                se = mon.get('error', 0)
                monitor_age = ufloat(sa, se, tag='monitor_age')
                monitor_material = mon.get('material', 'sanidine')
    fd = {'j': ufloat(j, je, tag='J'), 'position_jerr': pe, 'lambda_k': lambda_k, 'monitor_name': monitor_name, 'monitor_material': monitor_material, 'monitor_age': monitor_age}
    return fd
def get_flux_from_positions(self, position, positions):
    (j, je, pe, lambda_k) = (0, 0, 0, None)
    (monitor_name, monitor_material, monitor_age) = (DEFAULT_MONITOR_NAME, 'sanidine', ufloat(28.201, 0))
    if positions:
        pos = next((p for p in positions if (p['position'] == position)), None)
        if pos:
            (j, je, pe) = (pos.get('j', 0), pos.get('j_err', 0), pos.get('position_jerr', 0))
            dc = pos.get('decay_constants')
            if dc:
                if isinstance(dc, float):
                    (v, e) = (dc, 0)
                else:
                    (v, e) = (dc.get('lambda_k_total', 0), dc.get('lambda_k_total_error', 0))
                lambda_k = ufloat(v, e)
            mon = pos.get('monitor')
            if mon:
                monitor_name = mon.get('name', DEFAULT_MONITOR_NAME)
                sa = mon.get('age', 28.201)
                se = mon.get('error', 0)
                monitor_age = ufloat(sa, se, tag='monitor_age')
                monitor_material = mon.get('material', 'sanidine')
    fd = {'j': ufloat(j, je, tag='J'), 'position_jerr': pe, 'lambda_k': lambda_k, 'monitor_name': monitor_name, 'monitor_material': monitor_material, 'monitor_age': monitor_age}
    return fd