em_st_artifacts 1.0.0 copy "em_st_artifacts: ^1.0.0" to clipboard
em_st_artifacts: ^1.0.0 copied to clipboard

Library for calculation emotional states

example/lib/main.dart

import 'package:em_st_artifacts/em_st_artifacts.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late final EmotionalMath lib;

  @override
  void initState() {
    super.initState();

    final mathSettings = MathLibSettings(samplingRate: 250, fftWindow: 1000);
    final detectionSettings = ArtifactsDetectSetting(hanningWinSpectrum: true);
    final shortDetectioNSettings = ShortArtifactsDetectSetting(amplArtExtremumBorder: 25);
    final mentalSpectralSettings = MentalAndSpectralSetting();

    lib = EmotionalMath(mathSettings, detectionSettings, shortDetectioNSettings, mentalSpectralSettings);
  }

  void run() {
    print("[OK]");

    const int size = 500;
    double counter = 0;

    final samples = List<List<double>>.generate(size, (i) => [0, 0, 0, 0]);
    for (var data in samples) {
      for (var i = 0; i < data.length; i++) {
        data[i] = counter++;
      }
    }

    lib.pushMonopolars(samples);
    lib.processData();

    final spectralData = lib.readSpectralDataPercents();
    print("Spectral data | Size: ${spectralData.length}");
    for (var data in spectralData) {
      print("${data.alpha} ${data.beta} ${data.gamma}  ${data.theta} ${data.theta}");
    }

    final mentalData = lib.readMentalData();
    print("Mental data | Size: ${spectralData.length}");
    for (var data in mentalData) {
      print("${data.instAttention} ${data.instRelaxation} ${data.relAttention} ${data.relRelaxation}");
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Native Packages'),
        ),
        body: Center(
          child: ElevatedButton(
            onPressed: run,
            child: const Text("Run"),
          ),
        ),
      ),
    );
  }
}
0
likes
130
points
16
downloads

Publisher

verified publisherbrainbit.com

Weekly Downloads

Library for calculation emotional states

Homepage
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

ffi, flutter, plugin_platform_interface

More

Packages that depend on em_st_artifacts