This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np, pandas as pd | |
def markBlocks(data, condition, blockName): | |
df = data.copy() | |
### count the length of periods where the condition is satisfied | |
df['flag'] = np.where(condition, 1, 0) | |
## give a consequetive number to each step, where the the condition is satisfied | |
df['counter_' + blockName] = df.groupby((df['flag'] != df['flag'].shift(1)).cumsum()).cumcount()+1 | |
## drop the counter to zero when the condition is not satisfied |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qwerty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wr_device = device.Device(serial="WR2870546688") ## the one from Gautier | |
command_set = 1 # b'\x00\xe6\x00' # https://my.tado.com/support/index?home.id=21004 | |
subset = metadata[metadata.command_set_code == command_set] | |
print('Number of commands in the subset:', len(subset)) | |
cmd = subset.ir_data.values[1] | |
cmd = 'AF12D1A832B2121255540E65556F1A63E7586A07A96FB26B000053FF5500818B210001646110115580116164640065726570716F01111110001111010321000100001011011111001000000000011001011100001000000000001111111011111110111100001010000000000000101010054210001000010110111110010000001111101100001111110001111010321000100001011011111001000000000010110000111111000111101054' | |
cmd = metadata.ir_data.values[0] | |
org = 0 if metadata[metadata.ir_data == cmd].command_set_code.values[0] < 10000 else 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am tonybogomoloff on github. | |
* I am tonybogomoloff (https://keybase.io/tonybogomoloff) on keybase. | |
* I have a public key ASA3STRH5S3DoF5p9Y0bNoR0YKP-bTmq47gj7kKwGfdVbwo | |
To claim this, I am signing this object: |