pycoustic 0.1.14__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="%Y/%m/%d %H:%M", # Explicit format to avoid the dayfirst warning
22
- # dayfirst=False, # Optional: include for clarity; default is False
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
@@ -189,6 +189,7 @@ class Survey:
189
189
  return combi
190
190
  #test
191
191
  def modal(self, cols=None, by_date=False, day_t="60min", evening_t="60min", night_t="15min"):
192
+ #TODO rename second level index so it is not 'date'
192
193
  """
193
194
  Get a dataframe summarising Modal L90 values for each time period, as suggested by BS 4142:2014.
194
195
  Currently, this method rounds the values to 0 decimal places by default and there is no alternative
@@ -316,30 +317,71 @@ class Survey:
316
317
  For all Leq columns, use ["Leq"]. For specific columns, use list of tuples [("Leq", "A"), ("Leq", 125)]
317
318
  :return: A dataframe with a continuous Leq computation across dates, for each time period.
318
319
  """
319
- #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"])
320
320
  all_pos = []
321
+ labels = []
322
+
321
323
  if leq_cols is None:
322
324
  leq_cols = ["Leq"]
323
- for key in self._logs.keys():
324
- log = self._logs[key]
325
+
326
+ for label, log in self._logs.items():
325
327
  # Day
326
328
  days = log.get_period(data=log.get_antilogs(), period="days")
327
- 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
+
328
331
  # Night-time
329
332
  nights = log.get_period(data=log.get_antilogs(), period="nights")
330
- nights = nights[leq_cols].apply(lambda x: np.round(10*np.log10(np.mean(x)), DECIMALS))
331
- df = pd.DataFrame
332
- # Evening
333
+ nights = nights[leq_cols].apply(lambda x: np.round(10 * np.log10(np.mean(x)), DECIMALS))
334
+
335
+ # Evening (if applicable)
333
336
  if log.is_evening():
334
337
  evenings = log.get_period(data=log.get_antilogs(), period="evenings")
335
338
  evenings = evenings[leq_cols].apply(lambda x: np.round(10 * np.log10(np.mean(x)), DECIMALS))
336
339
  df = pd.concat([days, evenings, nights], axis=1, keys=["Daytime", "Evening", "Night-time"])
337
340
  else:
338
341
  df = pd.concat([days, nights], axis=1, keys=["Daytime", "Night-time"])
342
+
339
343
  all_pos.append(df)
340
- combi = pd.concat(all_pos, axis=1, keys=["UA1", "UA2"])
341
- combi = combi.transpose()
342
- return combi
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
343
385
 
344
386
  def get_start_end(self):
345
387
  starts = [self._logs[key].get_start() for key in self._logs.keys()]
@@ -1,19 +1,18 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pycoustic
3
- Version: 0.1.14
3
+ Version: 0.1.16
4
4
  Summary:
5
5
  Author: thumpercastle
6
6
  Author-email: tony.ryb@gmail.com
7
- Requires-Python: >=3.10,<=3.13
7
+ Requires-Python: >=3.11,<=3.13
8
8
  Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.10
10
9
  Classifier: Programming Language :: Python :: 3.11
11
10
  Classifier: Programming Language :: Python :: 3.12
12
11
  Classifier: Programming Language :: Python :: 3.13
13
12
  Requires-Dist: numpy (==2.3.3)
14
13
  Requires-Dist: openpyxl (==3.1.5)
15
14
  Requires-Dist: pandas (==2.3.3)
16
- Requires-Dist: plotly (==6.1.2)
15
+ Requires-Dist: plotly (>=6.3.1,<7.0.0)
17
16
  Requires-Dist: requests (>=2.32.4,<3.0.0)
18
17
  Requires-Dist: streamlit (>=1.46.1,<2.0.0)
19
18
  Description-Content-Type: text/markdown
@@ -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=DWC17aqRx2FgnLw2Y93BfCY3gFfqEx9FXboROssdmSQ,26093
5
- pycoustic/tkgui.py,sha256=YAy5f_qkXZ3yU8BvB-nIVQX1fYwPs_IkwmDEXHPMAa4,13997
6
- pycoustic/weather.py,sha256=q9FbDKjY0WaNvaYMHeDk7Bhbq0_Q7ehsTM_vUaCjeAk,3753
7
- pycoustic-0.1.14.dist-info/METADATA,sha256=3uP7gdURbo0gGnRahKFdsSnbqqLuUq6nCRTPcm_7fWI,8516
8
- pycoustic-0.1.14.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
9
- pycoustic-0.1.14.dist-info/RECORD,,