waveform-analysis 0.1.37 → 0.1.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest'
3
3
  import { createSimulatedWaveformData } from './simulatedWaveforms'
4
4
 
5
5
  describe('simulated waveform data', () => {
6
- it('creates deterministic, finite six-channel data', () => {
6
+ it('creates deterministic, finite seven-channel data with a two-series second frame', () => {
7
7
  const first = createSimulatedWaveformData()
8
8
  const second = createSimulatedWaveformData()
9
9
 
@@ -11,8 +11,12 @@ describe('simulated waveform data', () => {
11
11
  expect(first.kind).toBe('series')
12
12
  if (first.kind !== 'series') return
13
13
 
14
- expect(first.series).toHaveLength(6)
15
- expect(new Set(first.series.map((series) => series.id)).size).toBe(6)
14
+ expect(first.series).toHaveLength(7)
15
+ expect(new Set(first.series.map((series) => series.id)).size).toBe(7)
16
+ const secondFrame = first.series.filter(
17
+ (series) => series.trackId === 'simulated-harmonic-frame',
18
+ )
19
+ expect(secondFrame).toHaveLength(2)
16
20
  expect(new Set(first.series.map((series) => series.shotNo))).toEqual(new Set(['13300']))
17
21
  first.series.forEach((series) => {
18
22
  expect(series.data.kind).toBe('points')
@@ -13,7 +13,7 @@ type ErrorGenerator = (
13
13
 
14
14
  interface SimulatedSeriesDefinition extends Pick<
15
15
  WaveformSeries,
16
- 'id' | 'shotNo' | 'name' | 'unit' | 'lineType' | 'pointType' | 'errorBar'
16
+ 'id' | 'trackId' | 'shotNo' | 'name' | 'unit' | 'color' | 'lineType' | 'pointType' | 'errorBar'
17
17
  > {
18
18
  signal: SignalGenerator
19
19
  errors?: ErrorGenerator
@@ -60,6 +60,7 @@ const seriesDefinitions: SimulatedSeriesDefinition[] = [
60
60
  },
61
61
  {
62
62
  id: 'simulated-harmonic',
63
+ trackId: 'simulated-harmonic-frame',
63
64
  shotNo: '13300',
64
65
  name: '谐波扰动',
65
66
  unit: 'V',
@@ -68,6 +69,18 @@ const seriesDefinitions: SimulatedSeriesDefinition[] = [
68
69
  signal: (time) =>
69
70
  0.9 * Math.sin(TWO_PI * 0.55 * time) + 0.28 * Math.sin(TWO_PI * 2.2 * time + 0.4),
70
71
  },
72
+ {
73
+ id: 'simulated-harmonic-reference',
74
+ trackId: 'simulated-harmonic-frame',
75
+ shotNo: '13300',
76
+ name: '谐波对比',
77
+ unit: 'V',
78
+ color: '#2ca02c',
79
+ lineType: 'linear',
80
+ pointType: 'none',
81
+ signal: (time) =>
82
+ 0.62 * Math.sin(TWO_PI * 0.55 * time + 0.55) + 0.18 * Math.sin(TWO_PI * 2.2 * time - 0.2),
83
+ },
71
84
  {
72
85
  id: 'simulated-damped',
73
86
  shotNo: '13300',
@@ -58,6 +58,18 @@ export function visibilitySeries(): WaveformData {
58
58
  ],
59
59
  },
60
60
  },
61
+ {
62
+ id: 'mid',
63
+ trackId: 'shared-frame',
64
+ name: '中量程',
65
+ data: {
66
+ kind: 'points',
67
+ points: [
68
+ { x: 0, y: 100 },
69
+ { x: 1, y: 200 },
70
+ ],
71
+ },
72
+ },
61
73
  ],
62
74
  }
63
75
  }