Skip to content

Version 0.5.0 — API improvements and bugfixes

Choose a tag to compare

@vitaliy-ch25 vitaliy-ch25 released this 04 Jun 19:34
b95055c

What's Changed

  • New dlmo() function in markers.py computes DLMO from the rising slope only, returning a DLMOResult with dlmo phase and threshold; raises ValueError with a descriptive message (threshold value and data range) if the waveform never crosses the threshold
  • New DLMOResult dataclass with __str__() and to_dict() (timing as HH:MM string); accepted by ResultsCollector.add() alongside SessionInfo and FitResult
  • example_dlmo.py updated to use dlmo() and restricted to bcf/sbcf (bimodal functions are not appropriate for onset-only partial data); gen_time_range() call uses full_day=False
  • Module docstrings added to all three example scripts
  • melafit/__init__.py: corrected description of the midpoint marker
  • example_one_fit.py: collector.add() now includes the fit result (res)
  • Unit tests added for DLMOResult, dlmo(), and ResultsCollector integration with DLMOResult
  • day_profile() gains an interp parameter (default None) for optional interpolation of empty bins before averaging, useful for sparse raw data
  • All marker functions (dlmo, midpoint, area_cog) now accept a binsize parameter and apply interp='linear' by default, so sparse inputs are interpolated automatically before phase/marker extraction
  • amplitude() and area_cog() switch to np.nanmin/np.nanmax so input NaNs (e.g. empty Excel cells) are ignored rather than propagated
  • Unit tests added for interior NaN handling (TestInteriorNaNHandling)
  • Fixed a bug in day_profile() that caused an error when the input data had a sampling period other than 1 minute; the function now correctly handles raw data and fitted curves at any temporal resolution. Combined with the new interp parameter and binsize support in the marker functions, it is now also possible to extract phase markers directly from raw data without any prior curve fitting or interpolation
  • Fitting and marker functions (fit(), amplitude(), dlmo(), midpoint(), area_cog(), day_profile()) now accept pd.Series for value arguments and pd.Series/pd.DatetimeIndex for time arguments
  • gen_time_range() switched from np.arange to integer step counting to avoid off-by-one errors from floating-point rounding
  • area_cog(): baseline fallback to nanmin is now computed from the resampled waveform (after day_profile()) rather than the raw input
  • area_cog() and midpoint() docstrings note the 24 h coverage assumption
  • Unit tests added: TestSeriesInput (all new input combinations) and TestMarkersFromRawData (all four markers applied to sparse participant data without curve fitting)

See the README for installation instructions and getting started.