MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / SimpleAnalysis

Class SimpleAnalysis

src/main/java/trace/video/SimpleAnalysis.kt:8–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6// loads a csv file for the images in a directory
7
8class SimpleAnalysis(val fn: String) {
9 val data = mutableListOf<List<Float>>()
10
11 init {
12 val lines = Files.readAllLines(File(fn).toPath())
13 for (s in lines) {
14 val pieces = s.split(",")
15 data.add(pieces.map { it.toFloat() }.toList())
16 }
17 }
18
19 fun map(x: java.util.function.Function<List<Float>, Number?>): List<Int> {
20 return data.mapIndexed { i, d -> i to x.apply(d) }.filter { it.second != null }.sortedBy { it.second!!.toDouble() }.map { it.first }
21 }
22}

Callers 1

getAnalysisMethod · 0.85

Calls 4

FileFunction · 0.85
splitMethod · 0.45
addMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected