141 lines
3.5 KiB
Plaintext
141 lines
3.5 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "2a640dcc-4696-408f-b1f0-0cdf917e4719",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"@file:Repository(\"https://repo.kotlin.link\")\n",
|
||
|
"@file:Repository(\"*mavenLocal\")\n",
|
||
|
"@file:DependsOn(\"ru.inr.mass:numass-workspace:0.1.0\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "2d193fb2-6c18-4c64-b5c3-3e9ed4099d5b",
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"val repo: DataTree<NumassDirectorySet> = Numass.readNumassRepository(\"D:\\\\Work\\\\Numass\\\\data\\\\test\")\n",
|
||
|
"repo"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "373de92b-2533-4cfc-820b-ca90b9d028fc",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"val numassSet = repo[\"set_7\"]\n",
|
||
|
"numassSet"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "d0845a15-2928-4e6e-a891-fee130ef5326",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"val point = numassSet.points.first{it.voltage == 14000.0}"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "842dfbcb-17f0-4df9-b5d4-2835f15f3a50",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"point"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "50df6925-82f5-4330-a1c2-3e43fb9cd17d",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"Plotly.plotNumassBlock(point, eventExtractor = NumassEventExtractor.TQDC)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "196f94ca-0439-4190-bda7-8d692c37b2db",
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"val frames = point.listFrames()\n",
|
||
|
"Plotly.page {\n",
|
||
|
" p { +\"${frames.size} frames\" }\n",
|
||
|
" h2 { +\"Random frames\" }\n",
|
||
|
" plot {\n",
|
||
|
" val random = kotlin.random.Random(1234)\n",
|
||
|
"\n",
|
||
|
" repeat(10) {\n",
|
||
|
" val frame = frames.random(random)\n",
|
||
|
" scatter {\n",
|
||
|
" y.numbers = frame.signal.map { (it.toUShort().toInt() - Short.MAX_VALUE).toShort() }\n",
|
||
|
" }\n",
|
||
|
" }\n",
|
||
|
" }\n",
|
||
|
" h2 { +\"Analysis\" }\n",
|
||
|
" plot {\n",
|
||
|
" histogram {\n",
|
||
|
" name = \"max\"\n",
|
||
|
" x.numbers = frames.map { frame -> frame.signal.maxOf { (it.toUShort().toInt() - Short.MAX_VALUE).toShort() } }\n",
|
||
|
" }\n",
|
||
|
"\n",
|
||
|
" histogram {\n",
|
||
|
" name = \"max-min\"\n",
|
||
|
" xbins {\n",
|
||
|
" size = 2.0\n",
|
||
|
" }\n",
|
||
|
" x.numbers = frames.map { frame ->\n",
|
||
|
" frame.signal.maxOf { it.toUShort().toInt() - Short.MAX_VALUE } -\n",
|
||
|
" frame.signal.minOf { it.toUShort().toInt() - Short.MAX_VALUE }\n",
|
||
|
" }\n",
|
||
|
" }\n",
|
||
|
" }\n",
|
||
|
"}"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "5320d9d5-eae3-469b-a1f2-5d33d3db286c",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Kotlin",
|
||
|
"language": "kotlin",
|
||
|
"name": "kotlin"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": "text/x-kotlin",
|
||
|
"file_extension": ".kt",
|
||
|
"mimetype": "text/x-kotlin",
|
||
|
"name": "kotlin",
|
||
|
"nbconvert_exporter": "",
|
||
|
"pygments_lexer": "kotlin",
|
||
|
"version": "1.6.20-dev-6372"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 5
|
||
|
}
|