Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
toolbox
WindEnergyToolbox
Commits
a7a9960c
Commit
a7a9960c
authored
7 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
new revolution_trigger method
parent
6a62c2d3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wetb/signal/subset_mean.py
+47
-1
47 additions, 1 deletion
wetb/signal/subset_mean.py
wetb/signal/tests/test_subset_mean.py
+31
-3
31 additions, 3 deletions
wetb/signal/tests/test_subset_mean.py
with
78 additions
and
4 deletions
wetb/signal/subset_mean.py
+
47
−
1
View file @
a7a9960c
...
...
@@ -136,7 +136,53 @@ def cycle_trigger(values, trigger_value=None, step=1, ascending=True, tolerance=
else
:
return
np
.
where
((
values
[
1
:]
<
trigger_value
-
tolerance
)
&
(
values
[:
-
1
]
>=
trigger_value
+
tolerance
))[
0
][::
step
]
def
revolution_trigger
(
values
,
rpm_dt
=
None
,
dmin
=
5
,
dmax
=
10
,
):
def
revolution_trigger
(
rotor_position
,
sample_frq
,
rotor_speed
,
max_no_round_diff
=
1
):
"""
Returns one index per revolution (minimum rotor position)
Parameters
----------
rotor_position : array_like
Rotor position [deg] (0-360)
sample_frq : int or float
Sample frequency [Hz]
rotor_speed : array_like
Rotor speed [RPM]
Returns
-------
nd_array : Array of indexes
"""
if
isinstance
(
rotor_speed
,
(
float
,
int
)):
rotor_speed
=
np
.
ones_like
(
rotor_position
)
*
rotor_speed
deg_per_sample
=
rotor_speed
*
360
/
60
/
sample_frq
sample_per_round
=
1
/
(
rotor_speed
/
60
/
sample_frq
)
thresshold
=
deg_per_sample
.
max
()
*
2
nround_rotor_speed
=
np
.
nansum
(
rotor_speed
/
60
/
sample_frq
)
mod
=
[
v
for
v
in
[
5
,
10
,
30
,
60
,
90
]
if
v
>
thresshold
][
0
]
nround_rotor_position
=
np
.
nansum
(
np
.
diff
(
rotor_position
)
%
mod
)
/
360
assert
abs
(
nround_rotor_position
-
nround_rotor_speed
)
<
max_no_round_diff
,
"
No of rounds from rotor_position (%.2f) mismatch with no_rounds from rotor_speed (%.2f)
"
%
(
nround_rotor_position
,
nround_rotor_speed
)
#print (nround_rotor_position, nround_rotor_speed)
rp
=
np
.
array
(
rotor_position
).
copy
()
#filter degree increase > thresshold
#rp[np.r_[True, np.diff(rp)>thresshold]] = np.nan
upper_indexes
=
np
.
where
((
rp
[:
-
1
]
>
(
360
-
thresshold
))
&
(
rp
[
1
:]
<
(
360
-
thresshold
)))[
0
]
lower_indexes
=
np
.
where
((
rp
[:
-
1
]
>
thresshold
)
&
(
rp
[
1
:]
<
thresshold
))[
0
]
+
1
# Best lower is the first lower after upper
best_lower
=
lower_indexes
[
np
.
searchsorted
(
lower_indexes
,
upper_indexes
)]
upper2lower
=
best_lower
-
upper_indexes
best_lower
=
best_lower
[
upper2lower
<
upper2lower
.
mean
()
*
2
]
max_dist_error
=
max
([
np
.
abs
((
i2
-
i1
)
-
np
.
mean
(
sample_per_round
[
i1
:
i2
]))
for
i1
,
i2
in
zip
(
best_lower
[:
-
1
],
best_lower
[
1
:])])
#assert max_dist_error < sample_frq/5, max_dist_error
return
best_lower
def
revolution_trigger_old
(
values
,
rpm_dt
=
None
,
dmin
=
5
,
dmax
=
10
,
):
"""
Return indexes where values are > max(values)-dmin and decreases more than dmax
If RPM and time step is provided, triggers steps < time of 1rpm is removed
...
...
This diff is collapsed.
Click to expand it.
wetb/signal/tests/test_subset_mean.py
+
31
−
3
View file @
a7a9960c
...
...
@@ -9,7 +9,7 @@ import unittest
import
numpy
as
np
from
wetb
import
gtsdf
from
wetb.signal.subset_mean
import
time_trigger
,
subset_mean
,
\
non_nan_index_trigger
,
revolution_trigger
non_nan_index_trigger
,
revolution_trigger
_old
,
revolution_trigger
from
wetb.utils.geometry
import
rpm2rads
...
...
@@ -68,10 +68,10 @@ class TestSubsetMean(unittest.TestCase):
ds
=
gtsdf
.
Dataset
(
tfp
+
'
azi.hdf5
'
)
azi
,
rpm
,
time
=
[
ds
(
x
)[
8403
:
8803
]
for
x
in
[
'
azi
'
,
'
Rot_cor
'
,
'
Time
'
]]
trigger
=
revolution_trigger
(
azi
)
trigger
=
revolution_trigger
_old
(
azi
)
np
.
testing
.
assert_array_equal
(
trigger
,
[
17
,
128
,
241
,
354
])
azi
[
64
]
=
358
trigger
=
revolution_trigger
(
azi
,
(
ds
(
'
Rot_cor
'
),
np
.
diff
(
time
).
mean
()))
trigger
=
revolution_trigger
_old
(
azi
,
(
ds
(
'
Rot_cor
'
),
np
.
diff
(
time
).
mean
()))
# import matplotlib.pyplot as plt
# t = np.arange(len(azi))
...
...
@@ -82,5 +82,33 @@ class TestSubsetMean(unittest.TestCase):
np
.
testing
.
assert_array_equal
(
trigger
,
[
(
128
,
241
),(
241
,
354
)])
def
test_revolution_trigger
(
self
):
rotor_position
=
np
.
arange
(
0.
,
360
*
10
,
4
)
rotor_position
+=
np
.
random
.
random
(
len
(
rotor_position
))
rotor_position
=
rotor_position
%
360
if
0
:
x1
=
np
.
random
.
randint
(
0
,
len
(
rotor_position
),
10
)
print
(
list
(
x1
))
x2
=
np
.
random
.
randint
(
0
,
len
(
rotor_position
),
10
)
print
(
list
(
x2
))
else
:
x1
=
[
447
,
854
,
595
,
804
,
847
,
488
,
412
,
199
,
675
,
766
]
x2
=
[
92
,
647
,
821
,
422
,
33
,
159
,
369
,
99
,
157
,
464
]
rotor_position
[
x1
]
+=
360
rotor_position
[
x2
]
-=
360
rotor_position
[
90
]
=
180
#rotor_position = np.array([0.027969170192937542, 4.8738812928381359, 8.3490557684647584, 12.778466029641653, 16.638967323267195, 20.637055087385736, 24.203215135705932, 28.459444294226614, 32.103278056104919, 36.49414733856829, 40.824175799890554, 44.959069970415271, 48.265338075185625, 52.679813880478953, 56.540136234914918, 60.613801502624405, 64.069451340466486, 68.506035756247982, 72.858621694077272, 76.864165669186377, 80.454078231552259, 84.834549977244592, 88.117366018011481, 92.6415076533481, 96.448226954830233, 100.74147386541706, 104.05264899329615, 108.70445047578677, 112.15773724302161, 116.62487393440466, 120.42409830357822, 124.59070847488204, 128.6449519801516, 132.92449368065098, 136.88229744294841, 140.97437798819104, 144.89877139335846, 148.90265260277673, 152.73212683477473, 156.53001421332172, 160.12283131316141, 164.49619998092174, 168.961786805191, 172.23768704081152, 176.58030927377717, 180.98695233907907, 184.94678224748185, 188.94060402501432, 192.35404048368147, 196.49271430337791, 200.54659405018347, 204.53981352146133, 208.9641727331954, 212.79318115240673, 216.24139140029027, 220.7064675974018, 224.75614754557682, 228.58289114270474, 232.93347258842701, 236.11629785364832, 240.80820528234506, 244.60975793058915, 248.28486339263355, 252.11023280719618, 256.92995015865114, 260.42401255084553, 264.36307406867996, 268.80350076008438, 272.7885239105467, 276.50426376148317, 280.66881243689591, 284.74451868912547, 288.5111778881855, 292.08646255532273, 296.11064050612259, 300.91470532112561, 304.70922622911706, 308.24314243542119, 312.90169887100438, 316.55595831247842, 320.01030934682302, 324.39506417231888, 328.27617798924081, 332.92931836221766, 336.85749726714903, 340.24529549823899, 344.79016925410207, 348.30954064952562, 352.71641899126632, 356.11890975481282, 180.0, 4.4046550718081221, 8.5681471357526107, 12.545784992347365, 16.001039829370484, 20.884820414911701, 24.127128754326066, 28.191752188190776, 32.212263344449582, 36.115153207782498, 40.352049827542771, 44.500274638497046, 48.372200220616207, 52.948445183312799, 56.718965340940031, 60.963152498815361, 64.933137994169556, 68.693283407930664, 72.656015574952221, 76.371063938539976, 80.143678047265837, 84.597339600835483, 88.552409636676259, 92.033221869640897, 96.164020785688365, 100.70935794504055, 104.93968751683212, 108.92102682568316, 112.97091937016756, 116.74097279545998, 120.81523963414088, 124.35914270029565, 128.59213826845132, 132.7825565011803, 136.54664974146436, 140.03397022324992, 144.00838989409709, 148.77635987277472, 152.10973864234609, 156.61427161074664, 160.84947748772606, 164.85820412385942, 168.01912993271503, 532.52648996096593, 176.07534441973633, 180.89974163239606, 184.61756995023336, 188.50867722852217, 192.47993582301228, 196.52065089074392, 200.54498265820291, 204.34462603129873, 208.53654412539197, 212.6537919230683, 216.90998593065785, 220.34203190596088, 224.61858441300853, 228.12128660738767, 232.44281910567781, 236.82192455740233, 240.64760310501254, 244.76412489815402, 248.20307006618395, 252.87626604096147, 256.71572129885237, 260.15686981828014, 264.89239491816693, 268.76163574946054, 272.4440754576583, 276.63636968483797, 280.14568950349678, 284.72061632566852, 288.26734219083392, 292.81960241844649, 296.75524286915288, 300.60100412259771, 304.30345634163257, 308.08998704978126, 312.59509478637801, 316.86941633015454, 320.42518874656184, 324.14364913833253, 328.41330830965182, 332.66418797778817, 336.54863155750297, 340.23804599867321, 344.02097879584278, 348.28476054643079, 352.24882008228712, 356.43834604925075, 0.33821008672157404, 4.941588255315537, 8.3505472339604694, 12.423609058366651, 16.267293588356097, 380.74652980251585, 24.63359342173294, 28.279930297445844, 32.209404708352963, 36.235685944213401, 40.661642089982706, 44.509683669742913, 48.674005516573857, 52.045626926302134, 56.611740598508618, 60.408244014515049, 64.868939501338218, 68.577591870701667, 72.216971685325802, 76.913122546641603, 80.998891681892019, 84.166232508552866, 88.100262709410913, 92.61688042726496, 96.606018396220065, 100.85886319325982, 104.40103836831042, 108.2661437403699, 112.06865312138973, 116.44830622929555, 120.67536375974089, 124.2562913822951, 128.17190785439197, 132.35179743266667, 136.08083252181393, 140.39063584413248, 144.88941969341386, 148.55330930396633, 152.80898957313752, 156.56836834142632, 160.6629093657175, 164.32466448912669, 168.05168919173082, 172.50349108483533, 176.80009911295883, 180.69481975974759, 184.42270144208612, 188.46906093617486, 192.14830719057636, 196.6619542613148, 200.48181690496426, 204.92150046181462, 208.1813780417956, 212.79569272248466, 216.17084199427029, 220.10916648434988, 224.66265508950767, 228.37121906461573, 232.21534552119942, 236.12113364568302, 240.32276129133402, 244.89008371774469, 248.8954674663388, 252.32095065703572, 256.29086301478787, 260.60120019006411, 264.41830031875679, 268.90505845765051, 272.59299914361304, 276.17808795444921, 280.00851755862891, 644.93867279702079, 288.12623797450919, 292.66056178903114, 296.32963648126815, 300.99597796064211, 304.3871565240604, 308.62796838779491, 312.80010288042718, 676.45872139152198, 320.97989564162776, 324.3686652284598, 328.14473513845815, 332.30902295026203, 336.44049418348459, 340.39002056544223, 344.06419651644933, 348.3581570517506, 352.43993813807151, 356.48280350787832, 0.30194252854767001, 4.7014016257196545, 8.8002641352020419, 12.066014786815231, 16.011264702825201, 20.648033694096284, 24.427039226026636, 28.160150125206656, 32.890369957723578, 36.910616832698679, 40.56914366352089, 44.603183277702328, 48.513401942080009, 412.44891344312737, 56.626105141817789, 60.969781651189578, 64.000884872787765, 68.025001740852986, 72.474660730510777, 76.502873806696471, 80.65336059740639, 84.003028620545592, 88.42940024883751, 92.708870579156383, 96.367828931912072, 100.59678589484292, 104.78920153042509, 108.33772048027913, 112.24626023805172, 116.72028633424611, 120.91670145529815, 124.26390920012591, 128.16637239231204, 132.19248727149329, 136.39407082648177, 140.33902104252297, 144.72146075459455, 148.38605526164952, 152.60449544607673, 156.7914631119329, 160.27537353433718, 164.26636709119248, 168.43974025661782, 172.61854036702994, -183.91587088254823, -179.11036570613373, 184.10749978397189, 188.10408003980615, 192.23448049262561, 196.39137126698597, 200.9101569336251, 204.20861022294457, 208.37485381894339, 212.36656851669613, 216.60762540283486, 220.02070392677888, 224.14854312512898, 228.15529651767156, 232.15816664689737, 236.47155274967827, 240.66515733950723, 244.38240826983952, 248.40790520051314, 252.42234100952146, 256.05733181210076, 260.8874105705213, 264.86409211534442, 268.38882906278855, 272.80411727554747, 276.53603513317535, 280.59033176479807, 284.37008849067706, 288.22163818282024, 292.29178219373102, 296.91730313515541, 300.18108916570736, 304.10366239251289, 308.26551177708097, 312.79791950146227, 316.62666420267533, 320.9472890201971, 324.62352617877445, 328.47808502646694, 332.19516834987962, 336.09879017924823, 340.7406767118141, 344.50854405423547, 348.36055410364406, 352.16384291283998, 356.69870458711603, 0.57677892316746693, 4.4431827564151263, 8.5535291153560138, 12.044811838594114, 16.777915836628836, 380.88845030885977, 24.336005042195893, 28.936973642752491, 32.531229341898097, 36.140818103132233, 40.879500196455638, 44.310040674507945, 48.050977150133576, 52.564652152619828, 56.326343652132664, 60.467337090182809, 64.721469522623011, 68.135254900623977, 72.293438857936962, 76.254527344690587, 80.595988118859623, 84.393713449763027, 88.987462968840646, 92.136687802172901, 96.202811059027908, 100.59802551084817, 104.63028957223014, 108.62575043474476, 112.05988136053588, -243.14390683615738, 120.32438999426859, 124.17086164106126, 128.61003405932911, 132.66809115209139, 136.99781731391954, 140.17464676868462, 144.42941169223195, 148.57515491734898, 152.13927074461117, 156.59210668550622, 160.26677975929147, 164.14411857867117, 168.08633329454278, 172.78501396162551, 176.60181225457859, 180.92459624332901, 184.88252811499524, 188.21631452363317, 192.79693946245266, 196.6665001889578, 200.80542242779984, 204.49208884946506, 208.40301040108579, 212.35748498902353, 216.28841813530539, 220.68601819407058, 224.99548850800147, 228.34495872824027, 232.93181599093668, 236.37409196877002, 240.3630341985313, 244.87664030649466, 248.07423085254527, 252.2049255818747, 256.70580334047963, 260.43521328703901, 264.28003284386205, 268.29727488034018, 272.61663382167399, 276.81539235559967, 280.2450657369443, 284.72465406698416, 288.78829875950578, 292.65401623799107, 296.21751321957368, 300.05051908784048, 304.82359941449863, 308.91494521872005, 312.78628074608741, 316.6603273675014, 320.85503467665103, 324.29326240293722, 328.78355040640486, 332.84303073997671, 336.88575645863671, 340.2400639078603, 344.18014028931452, 348.47065032300634, -7.051867829540015, 356.35482662334425, 360.02156174183324, 4.9517724158267811, 8.3972584767514036, 12.441793349090176, 16.163575464817995, 20.934189708324311, -335.29745471573437, 28.155114004511006, 32.822293472401952, 36.041189927786945, 40.563230191000457, 44.667830212885519, 48.600881168127898, 52.075334336914921, 56.64381564578639, 60.113704996577553, 64.448046892704269, 68.405292244739485, 72.80950776473469, 76.155406997856289, 80.401835478476187, 84.100358124283957, 88.178567419411593, 92.057380885331668, 96.041698645485894, 100.30335942608826, 104.4129563592935, 108.80984815254556, 112.94878656377227, 116.77566467007455, 120.9974495417282, 124.10530696531464, 128.56072111508593, 132.5379680929052, 136.39574513840375, 140.3961856938829, 144.0937126695826, 148.43303306949269, 152.41303237791863, 156.46259677337798, 160.30273487004888, 164.42479501315347, 168.41931823401683, 172.45663705692232, 176.27457745181118, 180.09818179864374, 184.67002723345786, 188.54663012184028, 192.55310142516851, 196.66815110172161, 200.08519061712627, 204.59996868760186, 208.52939831299636, 212.82727275496268, 216.00898689675159, 220.48030835967006, 224.46284454004285, 228.60967532843415, 232.89499835362562, 236.75046089887974, 240.8598320246906, 244.46979443887244, 248.99586024481096, 252.33148233934207, 256.9720433225657, 260.58535361103122, 264.3822010109925, 268.69136330910715, 272.52331322746704, 276.30536302137489, 280.02536698457379, 284.01695341135064, 288.92352057014023, 292.82323030878342, 296.4950445448535, 300.31152229565487, 304.77398386389768, 308.9909373288674, 312.106433922821, 316.34796728621404, 320.68993667233553, 324.65882875262196, 328.02233105210007, 332.0641010652821, 336.53181607442866, 340.44001216016022, 344.44872522035348, 348.35620683621346, 352.31256528869562, 356.17965249373628, 0.93010192976908002, -355.96314187305461, 368.40534511978194, 12.037635146099092, 16.563206990074832, 20.244767415931619, 24.486779414075954, 28.982683075569639, 32.500907371949324, 36.174996216934687, 40.905770185998335, 44.784756690878112, 48.054523242806226, 52.699304962694896, 56.757358032041793, 60.755735378540976, 64.575072776785419, 68.751476138004364, 72.175696037817033, 436.91518639769629, 80.631092150206769, 84.773547554844299, 88.366641559583059, 92.066648091700699, 96.657503686014479, 100.76863409792895, 104.79293660126996, 108.21574163535388, 112.46534766962395, 116.68680828018751, 120.54443083545175, 124.17900417481587, 128.40751547606942, 132.72931435772171, 136.32805199100994, 140.82280610513862, 144.67467337571316, 148.42906433656071, 152.88741269802949, 156.99730435778656, 160.20403800106851, 164.20761314190395, 168.72620106323347, 172.69864999735591, 176.54839039116814, 180.19775118062216, 184.19567000689813, 188.04463474476825, 192.90060232513224, 196.89354214125842, 200.79841826554457, 204.78192126274143, 208.27933126732432, 212.95404695326124, 216.21503844469908, 220.00360922124446, 224.52672508496198, 228.07212041838875, 232.14483479266028, 236.39898142412858, 240.78863756000874, 244.78332275015964, 248.76465753861658, 252.23886670642969, 256.45595281494934, 260.95652184741539, 264.60299313075029, 268.69610808655489, 272.83732401333054, 276.83154716180616, 280.66967547924696, 284.5509565344928, 288.45117766893873, 292.98703044645072, 296.02900739107963, 300.33382138429488, 304.80413448856643, 308.91641600784351, 312.73765646944912, 316.62754324765456, 320.01087662017517, 324.274243824726, 328.77879095045137, 332.92697441091741, 336.06209185892385, 340.08256661371706, 344.69329289799089, 348.86868375137101, 352.91948019730808, 356.24459076860649, 0.21132706688786129, 4.4784682364984292, 8.2827636258225539, 12.449919188117747, 16.397858193694447, 20.784903157894405, 24.594773177337629, 28.822463970751414, 32.568850730948725, 36.314030541123429, 40.956480817748798, 44.865677886520643, -311.86997367027561, 52.509073100794922, 56.024214152552759, 60.430231413608453, 64.166752897136575, 68.369603172344796, 72.085827266261731, 76.788988712833998, 80.421328771869867, 84.804895291066259, 88.698988626898426, 92.595156837849572, 96.004517110564848, 100.49621412820125, 104.24347474111119, 108.69020242244687, 112.23424362119886, 116.77548406453889, 120.3663368084317, 124.83911738962661, 128.4491086258754, 132.38804119105498, 136.77578345314487, 140.70286284979647, 144.99536418687649, 148.0165970693165, 152.96711272603898, 156.46069600893134, 160.25160810351417, 164.30512695354446, 168.7931564389819, 172.57394999785129, 176.80691083621059, 180.92512665062304, 184.17813887137072, 188.1927795059587, 192.10269767934051, 196.75669737315411, 200.44134263527303, 204.99252656089493, 208.54254090879704, 212.50860871447458, 216.23210567083242, -139.37804984900822, 224.97578863844819, 228.51443918752693, 232.2911471928569, 236.22980853652416, 240.98415994247398, 244.87073381442679, 248.60576145299501, 252.9994360892224, 256.24465271356075, 260.18599656090737, 264.17378693951696, 268.71139894089674, 272.47172936888182, 276.78239086952681, 280.89539024929718, 284.19533503819503, 288.45488561685124, 292.87329551928133, 296.25074384942127, 300.86756584734485, 304.42462350705955, 308.96459578497797, 312.59914287558377, 316.03727944689763, 320.37048155425737, 324.50967386703996, 328.03543869926261, 332.85532844906857, 336.63032023494316, 340.53212019451666, 344.83754549236846, 348.06619003124615, 352.15739294488867, 356.80723008943232, 0.96561392840794724, 4.0824181735210914, 8.046486929466937, 12.382807251262875, 16.507242148240948, 20.443466393671315, -335.50511787399955, 28.788707464673735, 32.573639545671085, 36.754756028536576, 40.480694807713917, 44.92594853286073, 48.657651480868481, 52.331550357107062, 56.620932178242128, 60.090149343536268, 64.047902940345466, 68.304269715625196, 72.014361902874953, 76.57366804521007, 80.617022451432604, 84.942258679025599, 88.828338172142594, 92.59620160268878, 96.702977532309887, 100.92551538175621, 104.03671512675965, 108.87919257440853, 112.96129167435811, 116.50336737817179, 120.19562733489056, 124.28785038657497, 128.80946228128551, 132.41872003097978, 136.70293544492051, 140.04731584022056, 144.25553785970487, 148.09776547757338, 152.60388352348355, 156.02780140086406, 160.90665654864324, 164.53896476910359, 168.28695655160345, 172.14145685239555, 176.75590388565115, 180.37334288734246, 184.22189073297477, 188.07749499641068, 192.27173785147534, 196.40340961700122, 200.25622567009304, 204.4592453074838, 208.21947683536837, 212.82355025566994, 216.88046462949751, 220.24511121663909, 224.40254477220651, 228.03766807202055, 232.25155657402001, 236.39145296552124, 240.81449242646067, 244.49334969720985, 248.75203038160726, 252.32337433085559, 256.0140039122316, 260.54147328112685, 264.20011989446766, 268.65596645112873, 272.97596212507779, 276.24214781216824, 280.82672107799317, 284.25937690865658, 288.37763737771547, 292.81025176708727, 296.86992914257189, 300.54742057969497, 304.21890736598107, 308.21202001785286, 312.46482203753567, 316.52199076643774, 320.36962776879136, 324.48952269214715, 328.70096436548783, 332.7563866094797, 336.40602602289209, 340.93006480337908, 344.61657277484073, 348.65324734471687, 352.07502862088631, 356.27509192712478, 0.81391260384634734, 4.0703328763233912, 8.9552053143111152, 12.329626499744336, 16.783720347155395, 20.263089701172703, 24.797399981843228, 28.781935847557179, 32.911553322222517, 36.683499944774667, 40.39771384763344, 44.378862241595016, 408.61294109862047, 52.835562961630785, 56.838566319868278, 60.826632375630197, 64.7250386835467, 68.748114758715474, 72.134096678686547, -283.11105246599118, 80.598344275758791, 84.860023300972898, 88.138339376980639, 92.061078082272616, 96.321202758767868, 100.0142659589942, 104.82239555005162, 108.2301969265327, 112.0761970906874, 116.93317832502316, 120.80384281822489, 124.19835872868998, 128.7939614175466, 132.07451541595083, 136.33402257019225, 140.70379959429101, 144.50102419428777, 148.52455063595562, 152.56649818517735, 156.60579004429246, 160.36520550032947, 164.66489623229836, 168.72577439944507, 172.80218805635241, 176.41939155185082, 180.67711538759795, 184.43738907045645, 188.19551218116385, 192.21584281346486, 196.38246613188403, 200.00840377686927, 204.86812648247587, 208.57114195071836, 212.67386774921397, 216.73215270426999, 220.54346796402615, 224.77496091473859, 228.46372950783234, 232.45190401514401, 236.80384333283519, 240.20414780330657, 244.39501247155795, 248.47212591658899, 252.83499795288844, 256.49870657320753, 260.06987533616575, 264.92837647921351, 268.64036732088016, 272.73904431120354, 276.09516062616285, 280.17737080127017, 284.51582381581329, 288.67523513321157, 292.60697016788936, 296.65280801761719, 300.83423629623348, 304.36209694876106, 308.27642817713968, 312.90903355078763, 316.6956093234262, 320.691185379942, 324.15960941166077, 328.37024256181212, 332.14362868255284, 336.47008871026219, 340.19326448386664, 344.03536446947828, 348.82918215035943, 352.80882672642929, 356.36909741083991])
#print (list(rotor_position))
indexes
=
revolution_trigger
(
rotor_position
,
20
,
1
/
(
90
/
20
/
60
))
np
.
testing
.
assert_array_equal
(
indexes
,
[
91
,
180
,
270
,
360
,
450
,
540
,
630
,
720
,
810
])
if
0
:
import
matplotlib.pyplot
as
plt
plt
.
plot
(
rotor_position
)
plt
.
plot
(
indexes
,
np
.
zeros_like
(
indexes
),
'
.
'
)
plt
.
show
()
if
__name__
==
"
__main__
"
:
unittest
.
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment