design – looking for source code or algorithm to do accelerometer only sleep classification

I need to find off the shelf or at least an algorithm for using accelerometer raw data to determine sleep classifications (wake, light, deep, REM).

UPDATE…

I tested github’s SLEEPPY python accelerometer-only, wrist worn sleep classifier, but it limits classification to sleep and awake periods, and does not measure sleep states (light, deep (N1 N2 N3 N4) or REM).