Coverage for tests/test_project.py: 100%

22 statements  

« prev     ^ index     » next       coverage.py v7.0.2, created at 2023-01-03 12:07 -0800

1from sleapyfaces.project import Project 

2import pandas as pd 

3 

4 

5def test_project(): 

6 noGlob = Project( 

7 base="/Users/annieehler/Projects/Jupyter_Notebooks/SLEAPyFaces/tests/data", 

8 DAQFile="DAQOutput.csv", 

9 BehFile="BehMetadata.json", 

10 SLEAPFile="SLEAP.h5", 

11 VideoFile="video.mp4", 

12 get_glob=False, 

13 ) 

14 

15 withGlob = Project( 

16 base="/Users/annieehler/Projects/Jupyter_Notebooks/SLEAPyFaces/tests/data", 

17 iterator={"week 1": "20211105", "week 2": "20211112"}, 

18 DAQFile="*.csv", 

19 BehFile="*.json", 

20 SLEAPFile="*.h5", 

21 VideoFile="*.mp4", 

22 get_glob=True, 

23 ) 

24 

25 assert noGlob.exprs[0].sleap.tracks.equals(withGlob.exprs[0].sleap.tracks) 

26 assert noGlob.exprs[0].sleap.path == noGlob.exprs[0].files.sleap.file 

27 assert withGlob.exprs[0].sleap.path == withGlob.exprs[0].files.sleap.file 

28 assert noGlob.exprs[0].sleap.path == withGlob.exprs[0].sleap.path 

29 

30 noGlob.buildColumns(["Mouse"], ["CSE008"]) 

31 withGlob.buildColumns(["Mouse"], ["CSE008"]) 

32 

33 assert noGlob.all_data.equals(withGlob.all_data) 

34 

35 noGlob.buildTrials(["Speaker_on", "LED590_on"], [False, True]) 

36 withGlob.buildTrials(["Speaker_on", "LED590_on"], [False, True]) 

37 

38 assert len(noGlob.exprs[0].trialData) == len(withGlob.exprs[0].trialData) 

39 assert noGlob.exprs[0].trials.equals(withGlob.exprs[0].trials) 

40 

41 noGlob.meanCenter() 

42 noGlob.zScore() 

43 noGlob.visualize() 

44 

45 withGlob.analyze() 

46 withGlob.visualize() 

47 

48 assert type(noGlob.pcas["pca2d"]) is pd.DataFrame