JDK update new vacuum controller
This commit is contained in:
parent
ee18f68928
commit
e549bad998
12
build.gradle
12
build.gradle
@ -1,5 +1,5 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = "1.3.10"
|
ext.kotlin_version = "1.3.50"
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
@ -10,14 +10,14 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//plugins{
|
plugins{
|
||||||
// id 'org.openjfx.javafxplugin' version '0.0.7' apply false
|
id 'org.openjfx.javafxplugin' version '0.0.8' apply false
|
||||||
//}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply plugin: 'idea'
|
apply plugin: 'idea'
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: "kotlin"
|
apply plugin: "org.jetbrains.kotlin.jvm"
|
||||||
|
|
||||||
group = 'inr.numass'
|
group = 'inr.numass'
|
||||||
version = '1.0.0'
|
version = '1.0.0'
|
||||||
@ -38,8 +38,6 @@ allprojects {
|
|||||||
testImplementation group: 'junit', name: 'junit', version: '4.+'
|
testImplementation group: 'junit', name: 'junit', version: '4.+'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = "1.8"
|
jvmTarget = "1.8"
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,5 @@
|
|||||||
#Fri Jun 16 20:54:50 MSK 2017
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5.0-bin.zip
|
|
||||||
|
57
gradlew
vendored
57
gradlew
vendored
@ -1,5 +1,21 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
##
|
||||||
## Gradle start up script for UN*X
|
## Gradle start up script for UN*X
|
||||||
@ -28,16 +44,16 @@ APP_NAME="Gradle"
|
|||||||
APP_BASE_NAME=`basename "$0"`
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS=""
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
|
|
||||||
warn ( ) {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
}
|
||||||
|
|
||||||
die ( ) {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
@ -109,8 +125,8 @@ if $darwin; then
|
|||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if $cygwin ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
@ -138,35 +154,30 @@ if $cygwin ; then
|
|||||||
else
|
else
|
||||||
eval `echo args$i`="\"$arg\""
|
eval `echo args$i`="\"$arg\""
|
||||||
fi
|
fi
|
||||||
i=$((i+1))
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
case $i in
|
case $i in
|
||||||
(0) set -- ;;
|
0) set -- ;;
|
||||||
(1) set -- "$args0" ;;
|
1) set -- "$args0" ;;
|
||||||
(2) set -- "$args0" "$args1" ;;
|
2) set -- "$args0" "$args1" ;;
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Escape application args
|
||||||
save ( ) {
|
save () {
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
APP_ARGS=$(save "$@")
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
18
gradlew.bat
vendored
18
gradlew.bat
vendored
@ -1,3 +1,19 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
|
|||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS=
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
allprojects {
|
allprojects {
|
||||||
apply plugin: "kotlin"
|
apply plugin: "kotlin"
|
||||||
|
|
||||||
|
// apply plugin: 'org.openjfx.javafxplugin'
|
||||||
|
//
|
||||||
|
// javafx {
|
||||||
|
// modules = [ 'javafx.controls' ]
|
||||||
|
// }
|
||||||
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = "1.8"
|
jvmTarget = "1.8"
|
||||||
|
@ -122,6 +122,7 @@ abstract class DeviceDisplayFX<D : Device> : Component(), Connection {
|
|||||||
* Default display shows only board pane and nothing else
|
* Default display shows only board pane and nothing else
|
||||||
*/
|
*/
|
||||||
class DefaultDisplay : DeviceDisplayFX<Device>() {
|
class DefaultDisplay : DeviceDisplayFX<Device>() {
|
||||||
|
|
||||||
override fun buildView(device: Device): UIComponent? = null
|
override fun buildView(device: Device): UIComponent? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
apply plugin: 'application'
|
apply plugin: 'application'
|
||||||
|
|
||||||
version = "0.5.0"
|
version = "0.6.0"
|
||||||
|
|
||||||
if (!hasProperty('mainClass')) {
|
if (!hasProperty('mainClass')) {
|
||||||
ext.mainClass = 'inr.numass.control.readvac.ReadVac'
|
ext.mainClass = 'inr.numass.control.readvac.ReadVac'
|
||||||
|
@ -27,10 +27,7 @@ class MKSBaratronDevice(context: Context, meta: Meta) : PortSensor(context, meta
|
|||||||
|
|
||||||
var channel by valueState("channel").intDelegate
|
var channel by valueState("channel").intDelegate
|
||||||
|
|
||||||
override val type: String
|
override val type: String get() = meta.getString("type", "numass.vac.baratron")
|
||||||
get() {
|
|
||||||
return meta.getString("type", "numass.vac.baratron")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun buildConnection(meta: Meta): GenericPortController {
|
override fun buildConnection(meta: Meta): GenericPortController {
|
||||||
val port: Port = PortFactory.build(meta)
|
val port: Port = PortFactory.build(meta)
|
||||||
|
@ -22,7 +22,11 @@ class ReadVac : NumassControlApplication<VacCollectorDevice>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getDeviceMeta(config: Meta): Meta {
|
override fun getDeviceMeta(config: Meta): Meta {
|
||||||
return MetaUtils.findNode(config,"device"){it.getString("name") == "numass.vac"}.orElseThrow{RuntimeException("Vacuum measurement configuration not found")}
|
return MetaUtils.findNode(config, "device") {
|
||||||
|
it.getString("type") == "numass:vac"
|
||||||
|
}.orElseThrow {
|
||||||
|
RuntimeException("Vacuum measurement configuration not found")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
package inr.numass.control.readvac
|
||||||
|
|
||||||
|
import hep.dataforge.context.Context
|
||||||
|
import hep.dataforge.control.devices.PortSensor
|
||||||
|
import hep.dataforge.control.ports.GenericPortController
|
||||||
|
import hep.dataforge.control.ports.Port
|
||||||
|
import hep.dataforge.control.ports.PortFactory
|
||||||
|
import hep.dataforge.meta.Meta
|
||||||
|
import inr.numass.control.DeviceView
|
||||||
|
|
||||||
|
//@ValueDef(key = "address")
|
||||||
|
@DeviceView(VacDisplay::class)
|
||||||
|
//@StateDef(value = ValueDef(key = "address", type = [ValueType.STRING], def = "001"))
|
||||||
|
class ThyroContVacDevice(context: Context, meta: Meta) : PortSensor(context, meta) {
|
||||||
|
//val address by valueState("address").stringDelegate
|
||||||
|
val address = "001"
|
||||||
|
|
||||||
|
override val type: String get() = meta.getString("type", "numass.vac.thyrocont")
|
||||||
|
|
||||||
|
override fun buildConnection(meta: Meta): GenericPortController {
|
||||||
|
val port: Port = PortFactory.build(meta)
|
||||||
|
logger.info("Connecting to port {}", port.name)
|
||||||
|
return GenericPortController(context, port) { it.endsWith("\r") }
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun String.checksum(): Char = (sumBy { it.toInt() } % 64 + 64).toChar()
|
||||||
|
|
||||||
|
private fun wrap(str: String): String = buildString {
|
||||||
|
append(str)
|
||||||
|
append(str.checksum())
|
||||||
|
append('\r')
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun startMeasurement(oldMeta: Meta?, newMeta: Meta) {
|
||||||
|
measurement {
|
||||||
|
val request = wrap("0010MV00")
|
||||||
|
val answer = sendAndWait(request)
|
||||||
|
if (answer.isEmpty()) {
|
||||||
|
updateState(CONNECTED_STATE, false)
|
||||||
|
notifyError("No connection")
|
||||||
|
} else {
|
||||||
|
updateState(CONNECTED_STATE, true)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
|
||||||
|
val address = answer.substring(0..2)
|
||||||
|
//if wrong answer
|
||||||
|
if (address != this.address) {
|
||||||
|
logger.warn("Expected response for address ${this.address}, bur received for $address")
|
||||||
|
notifyError("Wrong response address")
|
||||||
|
return@measurement
|
||||||
|
}
|
||||||
|
val dataSize = answer.substring(6..7).toInt()
|
||||||
|
val data = answer.substring(8, 8 + dataSize).toDouble()
|
||||||
|
if (data <= 0) {
|
||||||
|
notifyError("Non positive")
|
||||||
|
} else {
|
||||||
|
notifyResult(data)
|
||||||
|
}
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
logger.error("Parsing error", ex)
|
||||||
|
notifyError("Parse error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -47,17 +47,18 @@ class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection<S
|
|||||||
|
|
||||||
private val helper = StorageHelper(this, this::buildLoader)
|
private val helper = StorageHelper(this, this::buildLoader)
|
||||||
|
|
||||||
private val collector = object : DeviceListener {
|
private val collector = object : DeviceListener, Connection {
|
||||||
|
val averagingDuration: Duration = Duration.parse(meta.getString("averagingDuration", "PT30S"))
|
||||||
|
|
||||||
|
private val collector = RegularPointCollector(averagingDuration) {
|
||||||
|
notifyResult(it)
|
||||||
|
}
|
||||||
|
|
||||||
override fun notifyStateChanged(device: Device, name: String, state: Any) {
|
override fun notifyStateChanged(device: Device, name: String, state: Any) {
|
||||||
if (name == MEASUREMENT_RESULT_STATE) {
|
if (name == MEASUREMENT_RESULT_STATE) {
|
||||||
collector.put(device.name, (state as Meta).getValue("value"))
|
collector.put(device.name, (state as Meta).getValue("value"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val averagingDuration: Duration = Duration.parse(meta.getString("averagingDuration", "PT30S"))
|
|
||||||
private val collector = RegularPointCollector(averagingDuration) {
|
|
||||||
notifyResult(it)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -72,6 +73,7 @@ class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection<S
|
|||||||
super.init()
|
super.init()
|
||||||
for (s in sensors) {
|
for (s in sensors) {
|
||||||
s.init()
|
s.init()
|
||||||
|
s.connect(collector, Roles.DEVICE_LISTENER_ROLE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class VacCollectorDisplay : DeviceDisplayFX<VacCollectorDevice>() {
|
|||||||
private val sensorConnection = object : MeasurementListener, Connection {
|
private val sensorConnection = object : MeasurementListener, Connection {
|
||||||
override fun onMeasurementResult(measurement: Measurement<*>, result: Any, time: Instant?) {
|
override fun onMeasurementResult(measurement: Measurement<*>, result: Any, time: Instant?) {
|
||||||
if (result is Double) {
|
if (result is Double) {
|
||||||
table.put(measurement.device.name, result);
|
table[measurement.device.name] = result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ class VacDeviceFactory : DeviceFactory {
|
|||||||
"CM32" -> CM32Device(context, sensorConfig)
|
"CM32" -> CM32Device(context, sensorConfig)
|
||||||
"meradat" -> MeradatVacDevice(context, sensorConfig)
|
"meradat" -> MeradatVacDevice(context, sensorConfig)
|
||||||
"baratron" -> MKSBaratronDevice(context, sensorConfig)
|
"baratron" -> MKSBaratronDevice(context, sensorConfig)
|
||||||
|
"ThyroCont" -> ThyroContVacDevice(context,sensorConfig)
|
||||||
// VIRTUAL_SENSOR_TYPE -> VirtualDevice.randomDoubleSensor(context, sensorConfig)
|
// VIRTUAL_SENSOR_TYPE -> VirtualDevice.randomDoubleSensor(context, sensorConfig)
|
||||||
else -> throw RuntimeException("Unknown vacuum sensor type")
|
else -> throw RuntimeException("Unknown vacuum sensor type")
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package inr.numass.control.readvac
|
||||||
|
|
||||||
|
import hep.dataforge.context.Global
|
||||||
|
import hep.dataforge.meta.buildMeta
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
|
||||||
|
suspend fun main() {
|
||||||
|
val meta = buildMeta {
|
||||||
|
"name" to "PSP"
|
||||||
|
"port" to "tcp::192.168.111.32:4001"
|
||||||
|
"sensorType" to "ThyroCont"
|
||||||
|
}
|
||||||
|
val device = ThyroContVacDevice(Global, meta)
|
||||||
|
device.measure()
|
||||||
|
device.connected.set(true)
|
||||||
|
delay(400)
|
||||||
|
println(device.result)
|
||||||
|
device.connected.set(false)
|
||||||
|
|
||||||
|
}
|
@ -8,5 +8,6 @@
|
|||||||
<sensor name="Px" color="black" port="tcp::192.168.111.33:4003" sensorType="meradat" address="1"/>
|
<sensor name="Px" color="black" port="tcp::192.168.111.33:4003" sensorType="meradat" address="1"/>
|
||||||
<sensor name="Baratron" color="cyan" port="tcp::192.168.111.33:4004" sensorType="baratron"/>
|
<sensor name="Baratron" color="cyan" port="tcp::192.168.111.33:4004" sensorType="baratron"/>
|
||||||
<sensor name="Collector" color="magenta" port="tcp::192.168.111.33:4003" sensorType="meradat" address="2"/>
|
<sensor name="Collector" color="magenta" port="tcp::192.168.111.33:4003" sensorType="meradat" address="2"/>
|
||||||
|
<sensor name="PSP" port="tcp::192.168.111.32:4001" sensorType="ThyroCont" address="001"/>
|
||||||
</device>
|
</device>
|
||||||
</config>
|
</config>
|
||||||
|
@ -7,8 +7,8 @@ apply plugin: 'kotlin'
|
|||||||
|
|
||||||
//apply plugin: 'org.openjfx.javafxplugin'
|
//apply plugin: 'org.openjfx.javafxplugin'
|
||||||
//
|
//
|
||||||
//javafx{
|
//javafx {
|
||||||
// modules = [ 'javafx.controls']
|
// modules = [ 'javafx.controls' ]
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//if (!hasProperty('mainClass')) {
|
//if (!hasProperty('mainClass')) {
|
||||||
|
@ -11,15 +11,13 @@ import hep.dataforge.isAnonymous
|
|||||||
import hep.dataforge.meta.Laminate
|
import hep.dataforge.meta.Laminate
|
||||||
import hep.dataforge.meta.Meta
|
import hep.dataforge.meta.Meta
|
||||||
import hep.dataforge.meta.MetaUtils
|
import hep.dataforge.meta.MetaUtils
|
||||||
import hep.dataforge.tables.ColumnFormat
|
import hep.dataforge.tables.*
|
||||||
import hep.dataforge.tables.ColumnTable
|
|
||||||
import hep.dataforge.tables.ListColumn
|
|
||||||
import hep.dataforge.tables.Table
|
|
||||||
import hep.dataforge.values.ValueType.NUMBER
|
import hep.dataforge.values.ValueType.NUMBER
|
||||||
import hep.dataforge.values.ValueType.STRING
|
import hep.dataforge.values.ValueType.STRING
|
||||||
import hep.dataforge.values.Values
|
import hep.dataforge.values.Values
|
||||||
import inr.numass.data.analyzers.NumassAnalyzer.Companion.COUNT_RATE_ERROR_KEY
|
import inr.numass.data.analyzers.NumassAnalyzer.Companion.COUNT_RATE_ERROR_KEY
|
||||||
import inr.numass.data.analyzers.NumassAnalyzer.Companion.COUNT_RATE_KEY
|
import inr.numass.data.analyzers.NumassAnalyzer.Companion.COUNT_RATE_KEY
|
||||||
|
import inr.numass.data.analyzers.NumassAnalyzer.Companion.TIME_KEY
|
||||||
import inr.numass.pointExpression
|
import inr.numass.pointExpression
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
@ -121,6 +119,8 @@ object TransformDataAction : OneToOneAction<Table, Table>("numass.transform", Ta
|
|||||||
//replacing cr column
|
//replacing cr column
|
||||||
val res = table.addColumn(ListColumn.build(table.getColumn(COUNT_RATE_KEY).format, cr.stream()))
|
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()))
|
.addColumn(ListColumn.build(table.getColumn(COUNT_RATE_ERROR_KEY).format, crErr.stream()))
|
||||||
|
.sort(TIME_KEY)
|
||||||
|
|
||||||
|
|
||||||
context.output[this@TransformDataAction.name, name].render(res, meta)
|
context.output[this@TransformDataAction.name, name].render(res, meta)
|
||||||
return res
|
return res
|
||||||
@ -213,9 +213,7 @@ object TransformDataAction : OneToOneAction<Table, Table>("numass.transform", Ta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// override fun corrErr(point: Values): Double {
|
// override fun corrErr(point: Values): Double = 0.0
|
||||||
// return super.corrErr(point)
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// override fun hasError(): Boolean = yErr.isNullOrEmpty()
|
// override fun hasError(): Boolean = yErr.isNullOrEmpty()
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,16 @@ import hep.dataforge.stat.models.XYModel
|
|||||||
import hep.dataforge.tables.*
|
import hep.dataforge.tables.*
|
||||||
import hep.dataforge.useMeta
|
import hep.dataforge.useMeta
|
||||||
import hep.dataforge.useValue
|
import hep.dataforge.useValue
|
||||||
import hep.dataforge.values.*
|
import hep.dataforge.values.ValueType
|
||||||
|
import hep.dataforge.values.Values
|
||||||
|
import hep.dataforge.values.asValue
|
||||||
|
import hep.dataforge.values.edit
|
||||||
import hep.dataforge.workspace.tasks.task
|
import hep.dataforge.workspace.tasks.task
|
||||||
import inr.numass.NumassUtils
|
import inr.numass.NumassUtils
|
||||||
import inr.numass.actions.MergeDataAction
|
import inr.numass.actions.MergeDataAction
|
||||||
import inr.numass.actions.MergeDataAction.MERGE_NAME
|
import inr.numass.actions.MergeDataAction.MERGE_NAME
|
||||||
import inr.numass.actions.TransformDataAction
|
import inr.numass.actions.TransformDataAction
|
||||||
import inr.numass.addSetMarkers
|
import inr.numass.addSetMarkers
|
||||||
import inr.numass.data.analyzers.NumassAnalyzer
|
|
||||||
import inr.numass.data.analyzers.NumassAnalyzer.Companion.CHANNEL_KEY
|
import inr.numass.data.analyzers.NumassAnalyzer.Companion.CHANNEL_KEY
|
||||||
import inr.numass.data.analyzers.NumassAnalyzer.Companion.COUNT_KEY
|
import inr.numass.data.analyzers.NumassAnalyzer.Companion.COUNT_KEY
|
||||||
import inr.numass.data.analyzers.SmartAnalyzer
|
import inr.numass.data.analyzers.SmartAnalyzer
|
||||||
@ -230,21 +232,24 @@ val filterTask = task("filter") {
|
|||||||
} else {
|
} else {
|
||||||
dependsOn(analyzeTask, meta)
|
dependsOn(analyzeTask, meta)
|
||||||
}
|
}
|
||||||
|
configure(meta.getMetaOrEmpty("filter"))
|
||||||
}
|
}
|
||||||
pipe<Table, Table> { data ->
|
pipe<Table, Table> { data ->
|
||||||
|
|
||||||
if (!meta.hasMeta("filter")) return@pipe data
|
if(meta.isEmpty) return@pipe data
|
||||||
|
|
||||||
if (meta.hasValue("from") || meta.hasValue("to")) {
|
val result = if (meta.hasValue("from") || meta.hasValue("to")) {
|
||||||
val uLo = meta.getDouble("from", 0.0)
|
val uLo = meta.getDouble("from", 0.0)
|
||||||
val uHi = meta.getDouble("to", java.lang.Double.POSITIVE_INFINITY)
|
val uHi = meta.getDouble("to", java.lang.Double.POSITIVE_INFINITY)
|
||||||
this.log.report("Filtering finished")
|
|
||||||
Tables.filter(data, NumassPoint.HV_KEY, uLo, uHi)
|
Tables.filter(data, NumassPoint.HV_KEY, uLo, uHi)
|
||||||
} else if (meta.hasValue("condition")) {
|
} else if (meta.hasValue("condition")) {
|
||||||
Tables.filter(data, Predicate { ExpressionUtils.condition(meta.getString("condition"), it.unbox()) })
|
Tables.filter(data, Predicate { ExpressionUtils.condition(meta.getString("condition"), it.unbox()) })
|
||||||
} else {
|
} else {
|
||||||
throw RuntimeException("No filtering condition specified")
|
throw RuntimeException("No filtering condition specified")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.output.render(result, name = this.name, stage = "numass.filter")
|
||||||
|
return@pipe result
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,11 @@ repositories {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//apply plugin: 'org.openjfx.javafxplugin'
|
||||||
|
//
|
||||||
|
//javafx {
|
||||||
|
// modules = [ 'javafx.controls' ]
|
||||||
|
//}
|
||||||
|
|
||||||
if (!hasProperty('mainClass')) {
|
if (!hasProperty('mainClass')) {
|
||||||
ext.mainClass = 'inr.numass.viewer.Viewer'//"inr.numass.viewer.test.TestApp"
|
ext.mainClass = 'inr.numass.viewer.Viewer'//"inr.numass.viewer.test.TestApp"
|
||||||
|
Loading…
Reference in New Issue
Block a user