You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to implement some quick updates to yasa.hypno.simulate_hypno that accommodate the new Hypnogram class (see #105). I'd wait until #116 is merged, just noting now for discussion.
Return a yasa.Hypnogram instance instead of an integer array.
Fix annoying issue when using the trans_probas argument. Because of reindexing to get all stages in order, if a stage was allowed but not included in trans_probas, the reindexing makes a row of zeros and this fails the assertion check that all rows sum to 1.
Change reindexing to strings (because more easily accessible in yasa.Hypnogram, now YASA leans slightly more towards string hypno reps).
Add option to sprinkle in some randomly-placed Art/Uns in simulated hypnograms, specifically for testing other functions (because I often forget about having to handle these!).
Add yasa.Hypnogram.simulate_similar() method. See below.
The only slightly controversial thing I'm suggesting is the last idea. Here's how I think it would look:
classHypnogram:
...
defsimulate_similar(self, jitter_tib=False):
"""Return a simulated hypnogram based on properties of the current hypnogram."""tib=hypno.sleep_statistics()["TIB"]
ifjitter_tib:
tib+=np.random.randint(-10, 10)
sim_values=yasa.simulate_hypno(
tib=tib,
sf=hypno.sampling_frequency,
n_stages=hypno.n_stages,
trans_probas=self.transition_matrix()[1],
)
sim_hypno=yasa.Hypnogram(
values=sim_values,
n_stages=hypno.n_stages,
freq=hypno.freq,
start=hypno.start,
scorer=hypno.scorer,
)
returnsim_hypno
The text was updated successfully, but these errors were encountered:
I'd like to implement some quick updates to
yasa.hypno.simulate_hypno
that accommodate the new Hypnogram class (see #105). I'd wait until #116 is merged, just noting now for discussion.yasa.Hypnogram
instance instead of an integer array.trans_probas
argument. Because of reindexing to get all stages in order, if a stage was allowed but not included intrans_probas
, the reindexing makes a row of zeros and this fails the assertion check that all rows sum to 1.yasa.Hypnogram
, now YASA leans slightly more towards string hypno reps).yasa.Hypnogram.simulate_similar()
method. See below.The only slightly controversial thing I'm suggesting is the last idea. Here's how I think it would look:
The text was updated successfully, but these errors were encountered: