code: def filter_by_analysis_period(self, analysis_period):
          
          self._check_analysis_period(analysis_period)
          analysis_period = self._get_analysis_period_subset(analysis_period)
  
          if analysis_period.st_hour == 0 and analysis_period.end_hour == 23:
              # We can still return an Hourly Continuous Data Collection
              t_s = 60 / analysis_period.timestep
              st_ind = int((analysis_period.st_time.moy / t_s) -
                           (self.header.analysis_period.st_time.moy / t_s))
              end_ind = int((analysis_period.end_time.moy / t_s) -
                            (analysis_period.st_time.moy / t_s) + st_ind + 1)
              if end_ind > st_ind:
                  _filt_values = self._values[st_ind:end_ind]
              else:
                  _filt_values = self._values[st_ind:] + self._values[:end_ind]
              _filt_header = self.header.duplicate()
              _filt_header._analysis_period = analysis_period
              return HourlyContinuousCollection(_filt_header, _filt_values)
          else:
              # Filter using  HOYs and the result cannot be continuous
              _filtered_data = self.filter_by_moys(analysis_period.moys)
              _filtered_data.header._analysis_period = analysis_period
              return _filtered_data
docs: Filter the Data Collection based on an analysis period.
  
          Args:
             analysis period: A Ladybug analysis period
  
          Return:
              A new Data Collection with filtered data