Fixed model manager

This commit is contained in:
Alexander Nozik 2018-08-31 11:56:46 +03:00
parent 9e3dcd08d1
commit 0c44f45428
4 changed files with 33 additions and 5 deletions

View File

@ -114,6 +114,7 @@ class NumassPlugin : BasicPlugin() {
}
}
/**
* Load all numass model factories
*

View File

@ -29,7 +29,6 @@ import hep.dataforge.tables.Table
import hep.dataforge.tables.Tables
import hep.dataforge.values.ValueMap
import hep.dataforge.values.Values
import inr.numass.NumassUtils
import inr.numass.data.analyzers.NumassAnalyzer
import inr.numass.data.api.NumassPoint
import java.util.*
@ -60,7 +59,7 @@ object MergeDataAction : ManyToOneAction<Table, Table>("numass.merge", Table::cl
}
override fun afterGroup(context: Context, groupName: String, outputMeta: Meta, output: Table) {
context.output.get(name, groupName).render(NumassUtils.wrap(output, outputMeta))
context.output[name, groupName].render(output,outputMeta)
super.afterGroup(context, groupName, outputMeta, output)
}

View File

@ -11,7 +11,6 @@ import hep.dataforge.isAnonymous
import hep.dataforge.meta.Laminate
import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaUtils
import hep.dataforge.tables.ColumnFormat
import hep.dataforge.tables.ColumnTable
import hep.dataforge.tables.ListColumn
@ -19,7 +18,6 @@ import hep.dataforge.tables.Table
import hep.dataforge.values.ValueType.NUMBER
import hep.dataforge.values.ValueType.STRING
import hep.dataforge.values.Values
import inr.numass.NumassUtils
import inr.numass.data.analyzers.NumassAnalyzer.Companion.COUNT_RATE_ERROR_KEY
import inr.numass.data.analyzers.NumassAnalyzer.Companion.COUNT_RATE_KEY
import inr.numass.pointExpression
@ -103,7 +101,7 @@ object TransformDataAction : OneToOneAction<Table, Table>("numass.transform", Ta
val res = table.addColumn(ListColumn.build(table.getColumn(COUNT_RATE_KEY).format, cr.stream()))
.addColumn(ListColumn.build(table.getColumn(COUNT_RATE_ERROR_KEY).format, crErr.stream()))
context.output["", name].render(NumassUtils.wrap(res, meta))
context.output[this@TransformDataAction.name, name].render(res, meta)
return res
}

View File

@ -0,0 +1,30 @@
package inr.numass
import hep.dataforge.context.Global
import hep.dataforge.meta.buildMeta
import hep.dataforge.stat.fit.FitManager
import org.junit.Before
import org.junit.Test
class NumassPluginTest {
@Before
fun setup() {
NumassPlugin().startGlobal()
}
@Test
fun testModels() {
val meta = buildMeta("model") {
"modelName" to "sterile"
"resolution" to {
"width" to 8.3e-5
"tail" to "function::numass.resolutionTail.2017.mod"
}
"transmission" to {
"trapping" to "function::numass.trap.nominal"
}
}
val model = Global.load<FitManager>().buildModel(meta)
}
}