pycoustic 0.1.15__py3-none-any.whl → 0.1.16__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.
pycoustic/log.py
CHANGED
@@ -18,8 +18,8 @@ class Log:
|
|
18
18
|
path,
|
19
19
|
index_col="Time",
|
20
20
|
parse_dates=["Time"],
|
21
|
-
date_format="%
|
22
|
-
|
21
|
+
date_format="%d/%m/%Y %H:%M", # Explicit format to avoid the dayfirst warning
|
22
|
+
dayfirst=True, # Optional: include for clarity; default is False
|
23
23
|
)
|
24
24
|
self._master.index = pd.to_datetime(self._master.index)
|
25
25
|
self._master = self._master.sort_index(axis=1)
|
pycoustic/survey.py
CHANGED
@@ -317,30 +317,71 @@ class Survey:
|
|
317
317
|
For all Leq columns, use ["Leq"]. For specific columns, use list of tuples [("Leq", "A"), ("Leq", 125)]
|
318
318
|
:return: A dataframe with a continuous Leq computation across dates, for each time period.
|
319
319
|
"""
|
320
|
-
#TODO: C:\Users\tonyr\PycharmProjects\pycoustic\tests.py:674: FutureWarning: The behavior of pd.concat with len(keys) != len(objs) is deprecated. In a future version this will raise instead of truncating to the smaller of the two sequences combi = pd.concat(all_pos, axis=1, keys=["UA1", "UA2"])
|
321
320
|
all_pos = []
|
321
|
+
labels = []
|
322
|
+
|
322
323
|
if leq_cols is None:
|
323
324
|
leq_cols = ["Leq"]
|
324
|
-
|
325
|
-
|
325
|
+
|
326
|
+
for label, log in self._logs.items():
|
326
327
|
# Day
|
327
328
|
days = log.get_period(data=log.get_antilogs(), period="days")
|
328
|
-
days = days[leq_cols].apply(lambda x: np.round(10*np.log10(np.mean(x)), DECIMALS))
|
329
|
+
days = days[leq_cols].apply(lambda x: np.round(10 * np.log10(np.mean(x)), DECIMALS))
|
330
|
+
|
329
331
|
# Night-time
|
330
332
|
nights = log.get_period(data=log.get_antilogs(), period="nights")
|
331
|
-
nights = nights[leq_cols].apply(lambda x: np.round(10*np.log10(np.mean(x)), DECIMALS))
|
332
|
-
|
333
|
-
# Evening
|
333
|
+
nights = nights[leq_cols].apply(lambda x: np.round(10 * np.log10(np.mean(x)), DECIMALS))
|
334
|
+
|
335
|
+
# Evening (if applicable)
|
334
336
|
if log.is_evening():
|
335
337
|
evenings = log.get_period(data=log.get_antilogs(), period="evenings")
|
336
338
|
evenings = evenings[leq_cols].apply(lambda x: np.round(10 * np.log10(np.mean(x)), DECIMALS))
|
337
339
|
df = pd.concat([days, evenings, nights], axis=1, keys=["Daytime", "Evening", "Night-time"])
|
338
340
|
else:
|
339
341
|
df = pd.concat([days, nights], axis=1, keys=["Daytime", "Night-time"])
|
342
|
+
|
340
343
|
all_pos.append(df)
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
+
labels.append(label)
|
345
|
+
|
346
|
+
if not all_pos:
|
347
|
+
return pd.DataFrame()
|
348
|
+
|
349
|
+
# Concatenate across logs; keys match number of objects (no FutureWarning)
|
350
|
+
combi = pd.concat(all_pos, axis=1, keys=labels)
|
351
|
+
return combi.transpose()
|
352
|
+
#
|
353
|
+
# def leq_spectra(self, leq_cols=None):
|
354
|
+
# """
|
355
|
+
# Compute Leqs over daytime, evening and night-time periods.
|
356
|
+
# This is an overall Leq, and does not group Leqs by date.
|
357
|
+
# :param leq_cols: List of strings or List of Tuples.
|
358
|
+
# For all Leq columns, use ["Leq"]. For specific columns, use list of tuples [("Leq", "A"), ("Leq", 125)]
|
359
|
+
# :return: A dataframe with a continuous Leq computation across dates, for each time period.
|
360
|
+
# """
|
361
|
+
# #TODO: C:\Users\tonyr\PycharmProjects\pycoustic\tests.py:674: FutureWarning: The behavior of pd.concat with len(keys) != len(objs) is deprecated. In a future version this will raise instead of truncating to the smaller of the two sequences combi = pd.concat(all_pos, axis=1, keys=["UA1", "UA2"])
|
362
|
+
# all_pos = []
|
363
|
+
# if leq_cols is None:
|
364
|
+
# leq_cols = ["Leq"]
|
365
|
+
# for key in self._logs.keys():
|
366
|
+
# log = self._logs[key]
|
367
|
+
# # Day
|
368
|
+
# days = log.get_period(data=log.get_antilogs(), period="days")
|
369
|
+
# days = days[leq_cols].apply(lambda x: np.round(10*np.log10(np.mean(x)), DECIMALS))
|
370
|
+
# # Night-time
|
371
|
+
# nights = log.get_period(data=log.get_antilogs(), period="nights")
|
372
|
+
# nights = nights[leq_cols].apply(lambda x: np.round(10*np.log10(np.mean(x)), DECIMALS))
|
373
|
+
# df = pd.DataFrame
|
374
|
+
# # Evening
|
375
|
+
# if log.is_evening():
|
376
|
+
# evenings = log.get_period(data=log.get_antilogs(), period="evenings")
|
377
|
+
# evenings = evenings[leq_cols].apply(lambda x: np.round(10 * np.log10(np.mean(x)), DECIMALS))
|
378
|
+
# df = pd.concat([days, evenings, nights], axis=1, keys=["Daytime", "Evening", "Night-time"])
|
379
|
+
# else:
|
380
|
+
# df = pd.concat([days, nights], axis=1, keys=["Daytime", "Night-time"])
|
381
|
+
# all_pos.append(df)
|
382
|
+
# combi = pd.concat(all_pos, axis=1, keys=["UA1", "UA2"])
|
383
|
+
# combi = combi.transpose()
|
384
|
+
# return combi
|
344
385
|
|
345
386
|
def get_start_end(self):
|
346
387
|
starts = [self._logs[key].get_start() for key in self._logs.keys()]
|
@@ -0,0 +1,9 @@
|
|
1
|
+
pycoustic/__init__.py,sha256=jq9Tzc5nEgXh8eNf0AkAypmw3Dda9A-iSy-tyFaTksA,89
|
2
|
+
pycoustic/log.py,sha256=KPpxeIipu1AwsBIXan5XQihY38vezW1tUHd9LPFluC4,17824
|
3
|
+
pycoustic/pycoustic_gui_app.py,sha256=Hs61Y8fAp7uoRONa4RLSVl0UvGXZZ96n5eJGilErlAU,11143
|
4
|
+
pycoustic/survey.py,sha256=9J1Bug_PV3kRI8yBwGqsCY8QzjeSdMaa6-I3362rxDs,28054
|
5
|
+
pycoustic/tkgui.py,sha256=YAy5f_qkXZ3yU8BvB-nIVQX1fYwPs_IkwmDEXHPMAa4,13997
|
6
|
+
pycoustic/weather.py,sha256=q9FbDKjY0WaNvaYMHeDk7Bhbq0_Q7ehsTM_vUaCjeAk,3753
|
7
|
+
pycoustic-0.1.16.dist-info/METADATA,sha256=kf95v_1SskZfpyv4taDbwC2jZelX0eF4b3Mxes1-Sw8,8472
|
8
|
+
pycoustic-0.1.16.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
9
|
+
pycoustic-0.1.16.dist-info/RECORD,,
|
@@ -1,9 +0,0 @@
|
|
1
|
-
pycoustic/__init__.py,sha256=jq9Tzc5nEgXh8eNf0AkAypmw3Dda9A-iSy-tyFaTksA,89
|
2
|
-
pycoustic/log.py,sha256=e8rAy9hIYP2H-3vTDVe0-6swe_n_gXjuFCu6Q-xNiYQ,17827
|
3
|
-
pycoustic/pycoustic_gui_app.py,sha256=Hs61Y8fAp7uoRONa4RLSVl0UvGXZZ96n5eJGilErlAU,11143
|
4
|
-
pycoustic/survey.py,sha256=yPOCNLaNJ85MhNN5ehWPWM5EQ_ixsE9Y3ikk84yIfTY,26154
|
5
|
-
pycoustic/tkgui.py,sha256=YAy5f_qkXZ3yU8BvB-nIVQX1fYwPs_IkwmDEXHPMAa4,13997
|
6
|
-
pycoustic/weather.py,sha256=q9FbDKjY0WaNvaYMHeDk7Bhbq0_Q7ehsTM_vUaCjeAk,3753
|
7
|
-
pycoustic-0.1.15.dist-info/METADATA,sha256=T3GDJd8La3Bp2HJtl5qsM_eMc98EwNoru34KqZOJBAY,8472
|
8
|
-
pycoustic-0.1.15.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
9
|
-
pycoustic-0.1.15.dist-info/RECORD,,
|
File without changes
|