def test_circadian_model_time(self, mock_pd):
        mock_pd.read_csv.return_value = mock_return = MagicMock()
        mock_return.values = expected_return = np.array([1, 2, 3, 4, 5])
        actual_returned_value = TimeBasedFeatureService.load_circadian_model(
            "subjectA")

        self.assertListEqual(expected_return.tolist(),
                             actual_returned_value.tolist())
        mock_pd.read_csv.assert_called_once_with(str(
            TimeBasedFeatureService.get_path_for_circadian_model("subjectA")),
                                                 delimiter=' ')
    def build(subject_id):
        feature_count = ActivityCountFeatureService.load(subject_id)
        feature_hr = HeartRateFeatureService.load(subject_id)
        feature_time = TimeBasedFeatureService.load_time(subject_id)
        if Constants.INCLUDE_CIRCADIAN:
            feature_circadian = TimeBasedFeatureService.load_circadian_model(
                subject_id)
        else:
            feature_circadian = None
        feature_cosine = TimeBasedFeatureService.load_cosine(subject_id)
        labeled_sleep = PSGLabelService.load(subject_id)

        feature_dictionary = {
            FeatureType.count: feature_count,
            FeatureType.heart_rate: feature_hr,
            FeatureType.time: feature_time,
            FeatureType.circadian_model: feature_circadian,
            FeatureType.cosine: feature_cosine
        }

        subject = Subject(subject_id=subject_id,
                          labeled_sleep=labeled_sleep,
                          feature_dictionary=feature_dictionary)

        # Uncomment to save plots of every subject's data:
        # ax = plt.subplot(5, 1, 1)
        # ax.plot(range(len(feature_hr)), feature_hr)
        # ax = plt.subplot(5, 1, 2)
        # ax.plot(range(len(feature_count)), feature_count)
        # ax = plt.subplot(5, 1, 3)
        # ax.plot(range(len(feature_cosine)), feature_cosine)
        # ax = plt.subplot(5, 1, 4)
        # ax.plot(range(len(feature_circadian)), feature_circadian)
        # ax = plt.subplot(5, 1, 5)
        # ax.plot(range(len(labeled_sleep)), labeled_sleep)
        #
        # plt.savefig(str(Constants.FIGURE_FILE_PATH.joinpath(subject_id + '_applewatch.png')))
        # plt.close()
        return subject