def add_production(self, irrad, name, obj, commit=False, add=True):
    p = self.get_production(irrad, name, force=True)
    p.attrs = attrs = (INTERFERENCE_KEYS + RATIO_KEYS)
    kef = (lambda x: '{}_err'.format(x))
    if obj:

        def values():
            return ((k, getattr(obj, k), kef(k), getattr(obj, kef(k))) for k in attrs)
    else:

        def values():
            return ((k, 0, kef(k), 0) for k in attrs)
    for (k, v, ke, e) in values():
        setattr(p, k, v)
        setattr(p, ke, e)
    p.dump()
    if add:
        self.add(p.path, commit=commit)
def add_production(self, irrad, name, obj, commit=False, add=True):
    p = self.get_production(irrad, name, force=True)
    p.attrs = attrs = (INTERFERENCE_KEYS + RATIO_KEYS)
    kef = (lambda x: '{}_err'.format(x))
    if obj:

        def values():
            return ((k, getattr(obj, k), kef(k), getattr(obj, kef(k))) for k in attrs)
    else:

        def values():
            return ((k, 0, kef(k), 0) for k in attrs)
    for (k, v, ke, e) in values():
        setattr(p, k, v)
        setattr(p, ke, e)
    p.dump()
    if add:
        self.add(p.path, commit=commit)