<jupyter_start><jupyter_text>Analyzing data with PAAT========<jupyter_code>%%capture
import os
import h5py
import paat
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline

plt.rcParams['figure.figsize'] = [15, 3]
plt.rcParams['font.size'] = '13'
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'<jupyter_output><empty_output><jupyter_text>Load data from GT3X file------------------------To load data from a gt3x file, the `paat.io.read_gt3x` function is implemented inthe `paat.io` module. However, you can also call the function directly from the top-level:<jupyter_code>data, sample_freq = paat.read_gt3x("data/nwt_recording.gt3x")
%%capture --no-display
ax = sns.lineplot(data=data[['X', 'Y', 'Z']], legend=True)

labels = [(data.index[0] + pd.to_timedelta(minutes, unit='m')).strftime("%H:%M:%S") for minutes in range(len(ax.get_xticks()))]
ax.set_xticklabels(labels)   

# Set axes labels
ax.set_xlabel("Time", size=15)
ax.set_ylabel("Acceleration in g", size=15)

plt.tight_layout()
print('')<jupyter_output><empty_output><jupyter_text>Detect non-wear periods-----------------------Different methods to infer non-wear time from the raw acceleration signal areimplemented in the `paat.wear_time` module. We suggest to use`paat.wear_time.detect_non_wear_time_syed2021` published by [Syed et al. (2021)](https://doi.org/10.1038/s41598-021-87757-z) as this algorithm demonstrated the most accurate estimates for hip-worn ActiGraph acceleration. This function can also be called from the top-level:<jupyter_code>data.loc[:, "Non Wear Time"] = paat.detect_non_wear_time_syed2021(data, sample_freq)<jupyter_output><empty_output><jupyter_text>But there are also other non-wear time algorithm implemented in the `paat.wear_time`module. For wrist-worn accelerometer data, the method developed by [Hees et al (2011)](https://doi.org/10.1371/journal.pone.0022922) might be moreappropriate and is implemented in `paat.wear_time.detect_non_wear_time_hees2011` or can be called directly:<jupyter_code>data.loc[:, "Non Wear Time Hees"] = paat.detect_non_wear_time_hees2011(data, sample_freq)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1410730804810361, 'fraction_numerical': 0.033765032377428304, 'mean_word_length': 5.866666666666666, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '360344', 'license': 'MIT', 'n_tokens_mistral': 800, 'n_tokens_neox': 742, 'n_words': 188, 'path': 'docs/source/example_notebooks/analyze_data.ipynb', 'repo_name': 'Trybnetic/paat', 'size': '2162'}