circaPy 0.1.6.dev1__py3-none-any.whl → 0.1.6.dev3__py3-none-any.whl

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.
circaPy/activity.py CHANGED
@@ -328,7 +328,7 @@ def calculate_IS(data):
328
328
 
329
329
 
330
330
  @prep.validate_input
331
- def calculate_TV(data, subject_no=0):
331
+ def calculate_TV(data, col=0):
332
332
  r"""
333
333
  Calculates Timepoint Variability
334
334
 
@@ -363,7 +363,7 @@ def calculate_TV(data, subject_no=0):
363
363
  The TV value ranges from 0 to 1, lower is more stable.
364
364
  """
365
365
  # select the data
366
- curr_data = data.iloc[:, subject_no]
366
+ curr_data = data.iloc[:, col]
367
367
 
368
368
  # calculate mean
369
369
  mean_data = calculate_mean_activity(curr_data)
circaPy/episodes.py CHANGED
@@ -19,7 +19,7 @@ import circaPy.preprocessing as prep
19
19
 
20
20
  @prep.validate_input
21
21
  def find_episodes(
22
- data, subject_no=0, min_length="1s", max_interruption="0s", *args, **kwargs
22
+ data, col=0, min_length="1s", max_interruption="0s", *args, **kwargs
23
23
  ):
24
24
  """
25
25
  Identifies episodes in a time series of activity data for a specific subject,
@@ -31,7 +31,7 @@ def find_episodes(
31
31
  data : pd.DataFrame
32
32
  The activity data for multiple subjects, where each column represents
33
33
  a subject's activity over time, and the index is a time-based index.
34
- subject_no : int, optional
34
+ col : int, optional
35
35
  The column index of the subject to analyze. Default is 0.
36
36
  min_length : str or pandas.Timedelta, optional
37
37
  The minimum duration for an episode to be included in the results.
@@ -62,13 +62,13 @@ def find_episodes(
62
62
  ... "Subject 1": np.random.choice([0, 1], size=100, p=[0.8, 0.2]),
63
63
  ... "Subject 2": np.random.choice([0, 1], size=100, p=[0.7, 0.3]),
64
64
  ... }, index=index)
65
- >>> find_episodes(data, subject_no=0, min_length="3s", max_interruption="2s")
65
+ >>> find_episodes(data, col=0, min_length="3s", max_interruption="2s")
66
66
  2024-01-01 00:00:15 7.0
67
67
  2024-01-01 00:00:45 5.0
68
68
  dtype: float64
69
69
  """
70
70
  # select single column
71
- curr_data = data.iloc[:, subject_no]
71
+ curr_data = data.iloc[:, col]
72
72
 
73
73
  # Determine the threshold for episode identification
74
74
  zero_data = curr_data == 0
circaPy/periodogram.py CHANGED
@@ -9,7 +9,7 @@ import circaPy.preprocessing as prep
9
9
 
10
10
 
11
11
  @prep.validate_input
12
- def lomb_scargle_period(data, subject_no=0, low_period=20, high_period=30, **kwargs):
12
+ def lomb_scargle_period(data, col=0, low_period=20, high_period=30, **kwargs):
13
13
  """
14
14
  Calculates the Lomb-Scargle periodogram for a single column in a DataFrame.
15
15
 
@@ -18,7 +18,7 @@ def lomb_scargle_period(data, subject_no=0, low_period=20, high_period=30, **kwa
18
18
  data : pd.DataFrame
19
19
  Input DataFrame with time-series data. The index represents time, and
20
20
  the columns contain observations.
21
- subject_no : int, optional
21
+ col : int, optional
22
22
  The positional index of the column to analyze. Default is 0.
23
23
  low_period : float, optional
24
24
  The shortest period to search for, in hours. Default is 20.
@@ -42,7 +42,7 @@ def lomb_scargle_period(data, subject_no=0, low_period=20, high_period=30, **kwa
42
42
  Raises
43
43
  ------
44
44
  IndexError
45
- If `subject_no` is out of the valid range for the DataFrame columns.
45
+ If `col` is out of the valid range for the DataFrame columns.
46
46
  ValueError
47
47
  If `low_period` is greater than or equal to `high_period`.
48
48
 
@@ -58,9 +58,9 @@ def lomb_scargle_period(data, subject_no=0, low_period=20, high_period=30, **kwa
58
58
  contains only NaNs.
59
59
  """
60
60
  # Ensure the positional index is valid
61
- if subject_no < 0 or subject_no >= len(data.columns):
61
+ if col < 0 or col >= len(data.columns):
62
62
  raise IndexError(
63
- f"Invalid subject_no {subject_no}. Must be between 0 and"
63
+ f"Invalid col {col}. Must be between 0 and"
64
64
  f"{len(data.columns) - 1}."
65
65
  )
66
66
 
@@ -80,7 +80,7 @@ def lomb_scargle_period(data, subject_no=0, low_period=20, high_period=30, **kwa
80
80
  freq_hours = 1 / (freq * 3600)
81
81
 
82
82
  # Prepare observations
83
- observations = data.iloc[:, subject_no].values
83
+ observations = data.iloc[:, col].values
84
84
  observation_times = np.arange(len(data)) * sample_freq
85
85
 
86
86
  # Check if all NaN
circaPy/plots.py CHANGED
@@ -14,7 +14,7 @@ import circaPy.preprocessing as prep
14
14
  @prep.plot_kwarg_decorator
15
15
  def plot_actogram(
16
16
  data,
17
- subject_no=0,
17
+ col=0,
18
18
  light_col=-1,
19
19
  ylim=[0, 120],
20
20
  fig=False,
@@ -37,7 +37,7 @@ def plot_actogram(
37
37
  columns for each subject and one column for the light levels.
38
38
  WRONG - currently expecting list of dataframes, one for each animal
39
39
  and single column for each day
40
- subject_no : int
40
+ col : int
41
41
  which column number to plot, defaults to 0
42
42
  light_col : int
43
43
  which columns contains light information, defaults to -1
@@ -80,7 +80,7 @@ def plot_actogram(
80
80
  raise ValueError("Input Dataframe is empty. Cannot plot actogram")
81
81
 
82
82
  # select the correct data to plot for activity and light
83
- col_data = data.columns[subject_no]
83
+ col_data = data.columns[col]
84
84
  ldr_col = data.columns[light_col]
85
85
  data_plot = data.loc[:, col_data].copy()
86
86
  data_light = data.loc[:, ldr_col].copy()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: circaPy
3
- Version: 0.1.6.dev1
3
+ Version: 0.1.6.dev3
4
4
  Summary: For analysing circadian activity data
5
5
  Project-URL: Homepage, https://github.com/A-Fisk/circaPy
6
6
  Project-URL: Issues, https://github.com/A-Fisk/circaPy/issues
@@ -29,6 +29,8 @@ CircaPy is a python module for circadian analysis of activity data.
29
29
  It was developed using laboratory
30
30
  rodents data but is applicable across species and monitoring devices.
31
31
 
32
+ Full documentation is available at [circapy.readthedocs.io](https://circapy.readthedocs.io)
33
+
32
34
  A limited version is available as an [interactive
33
35
  website](https://circapywebsite.streamlit.app/)
34
36
 
@@ -1,8 +1,8 @@
1
1
  circaPy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- circaPy/activity.py,sha256=EGcd0QA0QwCgQQWWvThwnBctSURWTiRkbx2E_qj1T1s,12544
3
- circaPy/episodes.py,sha256=sqRFTWlclkh-z9RyA-s5rF463xkDbsE7ALkgr-KqKr4,15382
4
- circaPy/periodogram.py,sha256=kyzTW2HDBIbcLQut5gOevh_zd3sAfa0RnitCBXzaz8I,4364
5
- circaPy/plots.py,sha256=w5mw0-YI2rDLDaXrnvRQmEadukK5pLw06m-Zf4KpQdM,12709
2
+ circaPy/activity.py,sha256=I1B6zSlz_kpxRaaGv2h-PdjrOym0HNRhzhGlwiMKMf4,12530
3
+ circaPy/episodes.py,sha256=lzvwNv763ECskGZ2VqLiP4EfT8p6yYJKDvnHL5ZGHEA,15354
4
+ circaPy/periodogram.py,sha256=oIWOl30aokq5YZPU2EM7NZNQUvRN8DWCtg_-OmfSyz0,4308
5
+ circaPy/plots.py,sha256=G8YSb9p1bAekvhN0XqEaWsA5gXZyiBVKuLiIgvQ48wA,12688
6
6
  circaPy/preprocessing.py,sha256=WNmeNdOU83sdP9qC8Cj4Od42OjRqR48dlaJQd2OZb6E,9696
7
7
  circaPy/sleep_process.py,sha256=vMNFNRx__qls_eCaCEM374RWqvo2bAUNocbIjF5gbnk,2521
8
8
  circaPy/.idea/actigraphy_analysis.iml,sha256=6GnoPxQ6gF69BtdpKK3mmgHwqmzJglmUa9iI5jVDo6c,398
@@ -10,7 +10,7 @@ circaPy/.idea/misc.xml,sha256=d8VH1GDzWGVVZo58O51-wfPY_Il-rQ9exolep12oV74,219
10
10
  circaPy/.idea/modules.xml,sha256=ELB75pyQII1uEhIxCoEuFJWB5wlJfhAAuDpZkYE5xxU,290
11
11
  circaPy/.idea/vcs.xml,sha256=JpBk9bpzB9zTGgO1xpBpizRCwPACTBNYNhVC9J9VCa4,183
12
12
  circaPy/.idea/workspace.xml,sha256=2Tgp-vpRFqxCebvXxnPuUCfbcshS26qZ-5jMneikRpM,4178
13
- circapy-0.1.6.dev1.dist-info/METADATA,sha256=Ho_1FYOWOHK3KNRu0MBinMJkXsfOsa72oZzL7OZV9YE,2875
14
- circapy-0.1.6.dev1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
15
- circapy-0.1.6.dev1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
16
- circapy-0.1.6.dev1.dist-info/RECORD,,
13
+ circapy-0.1.6.dev3.dist-info/METADATA,sha256=w8iv9FCQ-tDtFZEX7r2WPuyvL2ifBU6tLBQFLjwTTEI,2968
14
+ circapy-0.1.6.dev3.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
15
+ circapy-0.1.6.dev3.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
16
+ circapy-0.1.6.dev3.dist-info/RECORD,,