Commit 9a6e9aa6 authored by Romain Reuillon's avatar Romain Reuillon

[Core] enh: add method data to output format

parent 82f7e181
...@@ -441,7 +441,7 @@ lazy val onvariableGrouping = OsgiProject(pluginDir, "org.openmole.plugin.groupi ...@@ -441,7 +441,7 @@ lazy val onvariableGrouping = OsgiProject(pluginDir, "org.openmole.plugin.groupi
/* Hook */ /* Hook */
def allHook = Seq(displayHook, fileHook, modifierHook, jsonHook) def allHook = Seq(displayHook, fileHook, modifierHook, jsonHook, omrHook)
lazy val displayHook = OsgiProject(pluginDir, "org.openmole.plugin.hook.display", imports = Seq("*")) dependsOn (openmoleDSL) settings (pluginSettings: _*) lazy val displayHook = OsgiProject(pluginDir, "org.openmole.plugin.hook.display", imports = Seq("*")) dependsOn (openmoleDSL) settings (pluginSettings: _*)
...@@ -454,6 +454,9 @@ lazy val modifierHook = OsgiProject(pluginDir, "org.openmole.plugin.hook.modifie ...@@ -454,6 +454,9 @@ lazy val modifierHook = OsgiProject(pluginDir, "org.openmole.plugin.hook.modifie
lazy val jsonHook = OsgiProject(pluginDir, "org.openmole.plugin.hook.json", imports = Seq("*")) dependsOn(openmoleDSL,json, replication % "test") settings ( lazy val jsonHook = OsgiProject(pluginDir, "org.openmole.plugin.hook.json", imports = Seq("*")) dependsOn(openmoleDSL,json, replication % "test") settings (
libraryDependencies += Libraries.scalatest) settings (pluginSettings: _*) libraryDependencies += Libraries.scalatest) settings (pluginSettings: _*)
lazy val omrHook = OsgiProject(pluginDir, "org.openmole.plugin.hook.omr", imports = Seq("*")) dependsOn(openmoleDSL,json, replication % "test") settings (
libraryDependencies += Libraries.scalatest) settings (pluginSettings: _*)
/* Method */ /* Method */
......
...@@ -141,7 +141,7 @@ package composition { ...@@ -141,7 +141,7 @@ package composition {
def hook[F]( def hook[F](
output: WritableOutput, output: WritableOutput,
values: Seq[Val[_]] = Vector.empty, values: Seq[Val[_]] = Vector.empty,
format: F = CSVOutputFormat(append = true))(implicit definitionScope: DefinitionScope, fileFormat: OutputFormat[F]): TaskNode = hook(FormattedFileHook(output = output, values = values, format = format)) format: F = CSVOutputFormat(append = true))(implicit definitionScope: DefinitionScope, fileFormat: OutputFormat[F, Any]): TaskNode = hook(FormattedFileHook(output = output, values = values, format = format))
def source(sources: Source*) = copy(sources = this.sources ++ sources) def source(sources: Source*) = copy(sources = this.sources ++ sources)
} }
......
...@@ -30,8 +30,8 @@ object CSVHook { ...@@ -30,8 +30,8 @@ object CSVHook {
object CSVOutputFormat { object CSVOutputFormat {
implicit def format: OutputFormat[CSVOutputFormat] = new OutputFormat[CSVOutputFormat] { implicit def format: OutputFormat[CSVOutputFormat, Any] = new OutputFormat[CSVOutputFormat, Any] {
override def write(format: CSVOutputFormat, output: WritableOutput, variables: Seq[Variable[_]]): FromContext[Unit] = FromContext { p override def write(format: CSVOutputFormat, output: WritableOutput, variables: Seq[Variable[_]], method: Any): FromContext[Unit] = FromContext { p
import p._ import p._
def headerLine = format.header.map(_.from(context)) getOrElse csv.header(variables.map(_.prototype), variables.map(_.value), arrayOnRow = format.arrayOnRow) def headerLine = format.header.map(_.from(context)) getOrElse csv.header(variables.map(_.prototype), variables.map(_.value), arrayOnRow = format.arrayOnRow)
......
...@@ -8,20 +8,21 @@ import org.openmole.core.exception.UserBadDataError ...@@ -8,20 +8,21 @@ import org.openmole.core.exception.UserBadDataError
import org.openmole.core.expansion.FromContext import org.openmole.core.expansion.FromContext
import org.openmole.core.workflow.builder._ import org.openmole.core.workflow.builder._
trait OutputFormat[T] { trait OutputFormat[T, -M] {
def write(format: T, output: WritableOutput, variables: Seq[Variable[_]]): FromContext[Unit] def write(format: T, output: WritableOutput, variables: Seq[Variable[_]], method: M): FromContext[Unit]
def validate(format: T): FromContextHook.ValidateParameters Seq[Throwable] def validate(format: T): FromContextHook.ValidateParameters Seq[Throwable]
def extension: String def extension: String
} }
object FormattedFileHook { object FormattedFileHook {
def apply[T: OutputFormat]( def apply[T, M](
format: T, format: T,
output: WritableOutput, output: WritableOutput,
values: Seq[Val[_]] = Vector.empty, values: Seq[Val[_]] = Vector.empty,
exclude: Seq[Val[_]] = Vector.empty, exclude: Seq[Val[_]] = Vector.empty,
name: Option[String] = None)(implicit valName: sourcecode.Name, definitionScope: DefinitionScope, fileFormat: OutputFormat[T]): mole.FromContextHook = method: M = None,
name: Option[String] = None)(implicit valName: sourcecode.Name, definitionScope: DefinitionScope, fileFormat: OutputFormat[T, M]): mole.FromContextHook =
Hook(name getOrElse "FileFormatHook") { parameters Hook(name getOrElse "FileFormatHook") { parameters
import parameters._ import parameters._
...@@ -30,7 +31,7 @@ object FormattedFileHook { ...@@ -30,7 +31,7 @@ object FormattedFileHook {
val ps = { if (values.isEmpty) context.values.map { _.prototype }.toVector else values }.filter { v !excludeSet.contains(v.name) } val ps = { if (values.isEmpty) context.values.map { _.prototype }.toVector else values }.filter { v !excludeSet.contains(v.name) }
val variables = ps.map(p context.variable(p).getOrElse(throw new UserBadDataError(s"Variable $p not found in hook $this"))) val variables = ps.map(p context.variable(p).getOrElse(throw new UserBadDataError(s"Variable $p not found in hook $this")))
fileFormat.write(format, output, variables).from(context) fileFormat.write(format, output, variables, method).from(context)
context context
} validate { p } validate { p
......
...@@ -24,7 +24,7 @@ package mole { ...@@ -24,7 +24,7 @@ package mole {
def CSVHook = mole.CSVHook def CSVHook = mole.CSVHook
def CSVOutputFormat = mole.CSVHook.CSVOutputFormat def CSVOutputFormat = mole.CSVHook.CSVOutputFormat
type OutputFormat[T] = mole.OutputFormat[T] type OutputFormat[T, D] = mole.OutputFormat[T, D]
type FromContextHook = mole.FromContextHook type FromContextHook = mole.FromContextHook
type FromContextSource = mole.FromContextSource type FromContextSource = mole.FromContextSource
} }
......
...@@ -37,8 +37,7 @@ class HookSpec extends FlatSpec with Matchers { ...@@ -37,8 +37,7 @@ class HookSpec extends FlatSpec with Matchers {
"A hook" should "intercept the execution of a task" in { "A hook" should "intercept the execution of a task" in {
val executed = new AtomicInteger(0) val executed = new AtomicInteger(0)
val p = Val[String]
val p = Val[String]("p")
val t1 = val t1 =
TestTask { _ + (p "test") } set ( TestTask { _ + (p "test") } set (
...@@ -66,7 +65,6 @@ class HookSpec extends FlatSpec with Matchers { ...@@ -66,7 +65,6 @@ class HookSpec extends FlatSpec with Matchers {
val t1 = val t1 =
TestTask { _ + (p "test") } set ( TestTask { _ + (p "test") } set (
name := "Test",
outputs += p outputs += p
) )
...@@ -83,4 +81,10 @@ class HookSpec extends FlatSpec with Matchers { ...@@ -83,4 +81,10 @@ class HookSpec extends FlatSpec with Matchers {
executed should equal(true) executed should equal(true)
} }
"Display hook" should "be accepted" in {
val t1 = EmptyTask()
val ex = t1 hook display
ex.run
}
} }
...@@ -7,8 +7,8 @@ import org.openmole.plugin.tool.json._ ...@@ -7,8 +7,8 @@ import org.openmole.plugin.tool.json._
object JSONOutputFormat { object JSONOutputFormat {
implicit def outputFormat = new OutputFormat[JSONOutputFormat] { implicit def outputFormat = new OutputFormat[JSONOutputFormat, Any] {
override def write(format: JSONOutputFormat, output: WritableOutput, variables: Seq[Variable[_]]): FromContext[Unit] = FromContext { p override def write(format: JSONOutputFormat, output: WritableOutput, variables: Seq[Variable[_]], method: Any): FromContext[Unit] = FromContext { p
import p._ import p._
import org.json4s._ import org.json4s._
import org.json4s.jackson.JsonMethods._ import org.json4s.jackson.JsonMethods._
......
/*
* Copyright (C) 2015 Romain Reuillon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.openmole.plugin.hook.omr
import org.openmole.core.pluginmanager._
import org.openmole.core.preference.ConfigurationInfo
import org.osgi.framework.BundleContext
class Activator extends PluginInfoActivator {
override def keyWordTraits = List()
override def stop(context: BundleContext): Unit = {
PluginInfo.unregister(this)
ConfigurationInfo.unregister(this)
}
override def start(context: BundleContext): Unit = {
import org.openmole.core.pluginmanager.KeyWord._
val keyWords: Vector[KeyWord] =
Vector( // TaskKeyWord(objectName(JSONHook)),
// OtherKeyWord(objectName(JSONOutputFormat))
)
PluginInfo.register(this, Vector(this.getClass.getPackage), keyWords = keyWords)
ConfigurationInfo.register(
this,
ConfigurationInfo.list()
)
}
}
\ No newline at end of file
//package org.openmole.plugin.hook.omr
//
//import org.openmole.core.dsl._
//import org.openmole.core.dsl.extension._
//import org.openmole.core.workflow.mole.FromContextHook
//import org.openmole.plugin.tool.json._
//
//object OMROutputFormat {
//
// implicit def outputFormat = new OutputFormat[OMROutputFormat, Any] {
// override def write(format: OMROutputFormat, output: WritableOutput, variables: Seq[Variable[_]]): FromContext[Unit] = FromContext { p ⇒
// import p._
// import org.json4s._
// import org.json4s.jackson.JsonMethods._
//
// implicit val formats = DefaultFormats
//
// output match {
// case WritableOutput.FileValue(file) ⇒
// file.from(context).withPrintStream(append = false, create = true) { ps ⇒
// ps.print(compact(render(variablesToJValue(variables))))
// }
// case WritableOutput.StreamValue(ps, prelude) ⇒
// prelude.foreach(ps.print)
// ps.println(pretty(render(variablesToJValue(variables))))
// }
// }
//
// override def validate(format: OMROutputFormat): FromContextHook.ValidateParameters ⇒ Seq[Throwable] = { p ⇒ Seq() }
// override def extension = ".omr"
// }
//
//}
//
//case class OMROutputFormat()
...@@ -35,24 +35,24 @@ package object directsampling { ...@@ -35,24 +35,24 @@ package object directsampling {
type Aggregation = AggregateTask.AggregateVal[_, _] type Aggregation = AggregateTask.AggregateVal[_, _]
implicit class DirectSamplingDSL(dsl: DSLContainer[DirectSampling]) extends DSLContainerHook(dsl) { implicit class DirectSamplingDSL(dsl: DSLContainer[DirectSampling]) extends DSLContainerHook(dsl) {
def hook[T: OutputFormat]( def hook[T](
output: WritableOutput, output: WritableOutput,
values: Seq[Val[_]] = Vector.empty, values: Seq[Val[_]] = Vector.empty,
format: T = CSVOutputFormat(append = true)): DSLContainer[DirectSampling] = { format: T = CSVOutputFormat(append = true))(implicit outputFormat: OutputFormat[T, DirectSampling]): DSLContainer[DirectSampling] = {
implicit val defScope = dsl.scope implicit val defScope = dsl.scope
dsl hook FormattedFileHook(output = output, values = values, format = format) dsl hook FormattedFileHook(output = output, values = values, format = format, method = dsl.data)
} }
} }
implicit class ReplicationDSL(dsl: DSLContainer[Replication]) extends DSLContainerHook(dsl) { implicit class ReplicationDSL(dsl: DSLContainer[Replication]) extends DSLContainerHook(dsl) {
def hook[T: OutputFormat]( def hook[T](
output: WritableOutput, output: WritableOutput,
values: Seq[Val[_]] = Vector.empty, values: Seq[Val[_]] = Vector.empty,
includeSeed: Boolean = false, includeSeed: Boolean = false,
format: T = CSVOutputFormat(append = true)): DSLContainer[Replication] = { format: T = CSVOutputFormat(append = true))(implicit outputFormat: OutputFormat[T, Replication]): DSLContainer[Replication] = {
implicit val defScope = dsl.scope implicit val defScope = dsl.scope
val exclude = if (!includeSeed) Seq(dsl.data.seed) else Seq() val exclude = if (!includeSeed) Seq(dsl.data.seed) else Seq()
dsl hook FormattedFileHook(output = output, values = values, exclude = exclude, format = format) dsl hook FormattedFileHook(output = output, values = values, exclude = exclude, format = format, method = dsl.data)
} }
} }
......
...@@ -11,7 +11,7 @@ import org.openmole.plugin.tool.pattern._ ...@@ -11,7 +11,7 @@ import org.openmole.plugin.tool.pattern._
import org.scalatest._ import org.scalatest._
import org.openmole.core.workflow.test._ import org.openmole.core.workflow.test._
class PatternCompositionSpec extends FlatSpec with Matchers { class DirectSamplingSpec extends FlatSpec with Matchers {
import org.openmole.core.workflow.test.Stubs._ import org.openmole.core.workflow.test.Stubs._
"Direct sampling" should "transmit explored inputs" in { "Direct sampling" should "transmit explored inputs" in {
...@@ -193,4 +193,15 @@ class PatternCompositionSpec extends FlatSpec with Matchers { ...@@ -193,4 +193,15 @@ class PatternCompositionSpec extends FlatSpec with Matchers {
mole.run mole.run
} }
"Direct samplings" should "accept display hook" in {
val l = Val[Double]
val model = EmptyTask() set (inputs += l)
DirectSampling(
model,
ExplicitSampling(l, Seq(1.0, 2.0))
) hook display
}
} }
\ No newline at end of file
...@@ -22,13 +22,17 @@ import org.openmole.core.dsl.extension._ ...@@ -22,13 +22,17 @@ import org.openmole.core.dsl.extension._
object SavePopulationHook { object SavePopulationHook {
case class EvolutionData()
def evolutionData(t: EvolutionWorkflow) = EvolutionData()
def resultVariables(t: EvolutionWorkflow) = FromContext { p def resultVariables(t: EvolutionWorkflow) = FromContext { p
import p._ import p._
context.variable(t.generationPrototype).toSeq ++ context.variable(t.generationPrototype).toSeq ++
t.operations.result(context(t.populationPrototype).toVector, context(t.statePrototype)).from(context) t.operations.result(context(t.populationPrototype).toVector, context(t.statePrototype)).from(context)
} }
def hook[F](t: EvolutionWorkflow, output: WritableOutput, frequency: Option[Long], last: Boolean, format: F)(implicit name: sourcecode.Name, definitionScope: DefinitionScope, outputFormat: OutputFormat[F]) = { def hook[F](t: EvolutionWorkflow, output: WritableOutput, frequency: Option[Long], last: Boolean, format: F)(implicit name: sourcecode.Name, definitionScope: DefinitionScope, outputFormat: OutputFormat[F, EvolutionData]) = {
Hook("SavePopulationHook") { p Hook("SavePopulationHook") { p
import p._ import p._
...@@ -44,7 +48,7 @@ object SavePopulationHook { ...@@ -44,7 +48,7 @@ object SavePopulationHook {
output match { output match {
case WritableOutput.FileValue(dir) case WritableOutput.FileValue(dir)
saveFile(dir) match { saveFile(dir) match {
case Some(outputFile) outputFormat.write(format, outputFile.from(context), resultVariables(t).from(context)).from(context) case Some(outputFile) outputFormat.write(format, outputFile.from(context), resultVariables(t).from(context), evolutionData(t)).from(context)
case None case None
} }
case o case o
...@@ -55,7 +59,7 @@ object SavePopulationHook { ...@@ -55,7 +59,7 @@ object SavePopulationHook {
case _ false case _ false
} }
if (save) outputFormat.write(format, o, resultVariables(t).from(context)).from(context) if (save) outputFormat.write(format, o, resultVariables(t).from(context), evolutionData(t)).from(context)
} }
context context
...@@ -63,7 +67,7 @@ object SavePopulationHook { ...@@ -63,7 +67,7 @@ object SavePopulationHook {
} }
def apply[T, F: OutputFormat](algorithm: T, output: WritableOutput, frequency: OptionalArgument[Long] = None, last: Boolean = false, format: F = CSVOutputFormat(unrollArray = true))(implicit wfi: WorkflowIntegration[T], name: sourcecode.Name, definitionScope: DefinitionScope) = { def apply[T, F](algorithm: T, output: WritableOutput, frequency: OptionalArgument[Long] = None, last: Boolean = false, format: F = CSVOutputFormat(unrollArray = true))(implicit wfi: WorkflowIntegration[T], name: sourcecode.Name, definitionScope: DefinitionScope, outputFormat: OutputFormat[F, EvolutionData]) = {
val t = wfi(algorithm) val t = wfi(algorithm)
hook(t, output, frequency.option, last = last, format = format) hook(t, output, frequency.option, last = last, format = format)
} }
...@@ -72,14 +76,14 @@ object SavePopulationHook { ...@@ -72,14 +76,14 @@ object SavePopulationHook {
object SaveLastPopulationHook { object SaveLastPopulationHook {
def apply[T, F](algorithm: T, output: WritableOutput, format: F = CSVOutputFormat(unrollArray = true))(implicit wfi: WorkflowIntegration[T], name: sourcecode.Name, definitionScope: DefinitionScope, outputFormat: OutputFormat[F]) = { def apply[T, F](algorithm: T, output: WritableOutput, format: F = CSVOutputFormat(unrollArray = true))(implicit wfi: WorkflowIntegration[T], name: sourcecode.Name, definitionScope: DefinitionScope, outputFormat: OutputFormat[F, SavePopulationHook.EvolutionData]) = {
val t = wfi(algorithm) val t = wfi(algorithm)
Hook("SaveLastPopulationHook") { p Hook("SaveLastPopulationHook") { p
import p._ import p._
import org.openmole.core.csv import org.openmole.core.csv
outputFormat.write(format, output, SavePopulationHook.resultVariables(t).from(context)).from(context) outputFormat.write(format, output, SavePopulationHook.resultVariables(t).from(context), SavePopulationHook.evolutionData(t)).from(context)
context context
} set (inputs += (t.populationPrototype, t.statePrototype)) } set (inputs += (t.populationPrototype, t.statePrototype))
......
...@@ -99,7 +99,7 @@ package object evolution { ...@@ -99,7 +99,7 @@ package object evolution {
implicit def workflowIntegration = WorkflowIntegration[DSLContainer[EvolutionWorkflow]](_.data) implicit def workflowIntegration = WorkflowIntegration[DSLContainer[EvolutionWorkflow]](_.data)
implicit class EvolutionMethodContainer(dsl: DSLContainer[EvolutionWorkflow]) extends DSLContainerHook(dsl) { implicit class EvolutionMethodContainer(dsl: DSLContainer[EvolutionWorkflow]) extends DSLContainerHook(dsl) {
def hook[F: OutputFormat](output: WritableOutput, frequency: OptionalArgument[Long] = None, last: Boolean = false, format: F = CSVOutputFormat()): DSLContainer[EvolutionWorkflow] = { def hook[F](output: WritableOutput, frequency: OptionalArgument[Long] = None, last: Boolean = false, format: F = CSVOutputFormat())(implicit outputFormat: OutputFormat[F, SavePopulationHook.EvolutionData]): DSLContainer[EvolutionWorkflow] = {
implicit val defScope = dsl.scope implicit val defScope = dsl.scope
dsl.hook(SavePopulationHook(dsl, output, frequency = frequency, last = last, format = format)) dsl.hook(SavePopulationHook(dsl, output, frequency = frequency, last = last, format = format))
} }
......
...@@ -5,7 +5,7 @@ import org.openmole.core.dsl.extension._ ...@@ -5,7 +5,7 @@ import org.openmole.core.dsl.extension._
object MorrisHook { object MorrisHook {
def apply[F](dsl: DSLContainer[Sensitivity.MorrisParams], output: WritableOutput, format: F = CSVOutputFormat())(implicit name: sourcecode.Name, definitionScope: DefinitionScope, outputFormat: OutputFormat[F]) = def apply[F](dsl: DSLContainer[Sensitivity.MorrisParams], output: WritableOutput, format: F = CSVOutputFormat())(implicit name: sourcecode.Name, definitionScope: DefinitionScope, outputFormat: OutputFormat[F, Sensitivity.MorrisParams]) =
Hook("MorrisHook") { p Hook("MorrisHook") { p
import p._ import p._
import WritableOutput._ import WritableOutput._
...@@ -14,13 +14,13 @@ object MorrisHook { ...@@ -14,13 +14,13 @@ object MorrisHook {
output match { output match {
case FileValue(dirFC) case FileValue(dirFC)
Sensitivity.writeResults(format, FileValue(dirFC / s"mu${outputFormat.extension}"), inputs, dsl.data.outputs, Morris.mu(_, _)).from(context) Sensitivity.writeResults(format, dsl.data, FileValue(dirFC / s"mu${outputFormat.extension}"), inputs, dsl.data.outputs, Morris.mu(_, _)).from(context)
Sensitivity.writeResults(format, FileValue(dirFC / s"muStar${outputFormat.extension}"), inputs, dsl.data.outputs, Morris.muStar(_, _)).from(context) Sensitivity.writeResults(format, dsl.data, FileValue(dirFC / s"muStar${outputFormat.extension}"), inputs, dsl.data.outputs, Morris.muStar(_, _)).from(context)
Sensitivity.writeResults(format, FileValue(dirFC / s"sigma${outputFormat.extension}"), inputs, dsl.data.outputs, Morris.sigma(_, _)).from(context) Sensitivity.writeResults(format, dsl.data, FileValue(dirFC / s"sigma${outputFormat.extension}"), inputs, dsl.data.outputs, Morris.sigma(_, _)).from(context)
case StreamValue(ps, prelude) case StreamValue(ps, prelude)
Sensitivity.writeResults(format, StreamValue(ps, Some(prelude.getOrElse("") + "mu\n")), inputs, dsl.data.outputs, Morris.mu(_, _)).from(context) Sensitivity.writeResults(format, dsl.data, StreamValue(ps, Some(prelude.getOrElse("") + "mu\n")), inputs, dsl.data.outputs, Morris.mu(_, _)).from(context)
Sensitivity.writeResults(format, StreamValue(ps, Some("muStar\n")), inputs, dsl.data.outputs, Morris.muStar(_, _)).from(context) Sensitivity.writeResults(format, dsl.data, StreamValue(ps, Some("muStar\n")), inputs, dsl.data.outputs, Morris.muStar(_, _)).from(context)
Sensitivity.writeResults(format, StreamValue(ps, Some("sigma\n")), inputs, dsl.data.outputs, Morris.sigma(_, _)).from(context) Sensitivity.writeResults(format, dsl.data, StreamValue(ps, Some("sigma\n")), inputs, dsl.data.outputs, Morris.sigma(_, _)).from(context)
} }
context context
} }
......
...@@ -5,7 +5,7 @@ import org.openmole.core.dsl.extension._ ...@@ -5,7 +5,7 @@ import org.openmole.core.dsl.extension._
object SaltelliHook { object SaltelliHook {
def apply[F](dsl: DSLContainer[Sensitivity.SaltelliParams], output: WritableOutput, format: F = CSVOutputFormat())(implicit name: sourcecode.Name, definitionScope: DefinitionScope, outputFormat: OutputFormat[F]) = def apply[F](dsl: DSLContainer[Sensitivity.SaltelliParams], output: WritableOutput, format: F = CSVOutputFormat())(implicit name: sourcecode.Name, definitionScope: DefinitionScope, outputFormat: OutputFormat[F, Sensitivity.SaltelliParams]) =
Hook("SaltelliHook") { p Hook("SaltelliHook") { p
import p._ import p._
import WritableOutput._ import WritableOutput._
...@@ -14,11 +14,11 @@ object SaltelliHook { ...@@ -14,11 +14,11 @@ object SaltelliHook {
output match { output match {
case FileValue(dirFC) case FileValue(dirFC)
Sensitivity.writeResults(format, FileValue(dirFC / s"firstOrderIndices${outputFormat.extension}"), inputs, dsl.data.outputs, Saltelli.firstOrder(_, _)).from(context) Sensitivity.writeResults(format, dsl.data, FileValue(dirFC / s"firstOrderIndices${outputFormat.extension}"), inputs, dsl.data.outputs, Saltelli.firstOrder(_, _)).from(context)