Return a copy of the analysis period.
337407
def duplicate(self):
        """"""
        return AnalysisPeriod(self.st_month, self.st_day, self.st_hour,
                              self.end_month, self.end_day, self.end_hour,
                              self.timestep, self.is_leap_year)
75117
def duplicate(self):
        """"""
        collection = self.__class__(self.header.duplicate(), self.values, self.datetimes)
        collection._validated_a_period = self._validated_a_period
        return collection
642330
def copy_analysis_dict( analysis ):
    '''  '''
    assert isinstance(analysis, dict), "(!) Input 'analysis' should be a dict!"
    new_dict = { POSTAG: analysis[POSTAG],\
                 ROOT: analysis[ROOT],\
                 FORM: analysis[FORM],\
                 CLITIC: analysis[CLITIC],\
                 ENDING: analysis[ENDING] }
    if LEMMA in analysis:
       new_dict[LEMMA] = analysis[LEMMA]
    if ROOT_TOKENS in analysis:
       new_dict[ROOT_TOKENS] = analysis[ROOT_TOKENS]
    return new_dict
312054
def getWorksheet(self):
        
        worksheet = self.getBackReferences('WorksheetAnalysis')
        if not worksheet:
            return None
        if len(worksheet) > 1:
            logger.error(
                "Analysis %s is assigned to more than one worksheet."
                % self.getId())
        return worksheet[0]
115980
def get_array(self, period):
        
        if self.variable.is_neutralized:
            return self.default_array()
        value = self._memory_storage.get(period)
        if value is not None:
            return value
        if self._disk_storage:
            return self._disk_storage.get(period)
653686
def copy(self):
        """"""
        return Eq(
            self._lhs, self._rhs, tag=self._tag,
            _prev_lhs=self._prev_lhs, _prev_rhs=self._prev_rhs,
            _prev_tags=self._prev_tags)
1088267
def dumper(self):
        """"""
        with open('{}{}_referenceprofile.json'.format(self.reportpath, self.analysistype, ), 'w') as referenceprofile:
            referenceprofile.write(json.dumps(self.referenceprofile, sort_keys=True, indent=4, separators=(',', ': ')))
136092
def get_blob(self, index):
        """"""
        blob = self._current_blob
        self.r.retrieve_timeslice(index)
        timeslice_info = Table.from_template({
            'frame_index': self.r.frame_index,
            'slice_id': index,
            'timestamp': self.r.utc_seconds,
            'nanoseconds': self.r.utc_nanoseconds,
            'n_frames': self.r.n_frames,
        }, 'TimesliceInfo')
        hits = self._extract_hits()
        hits.group_id = index
        blob['TimesliceInfo'] = timeslice_info
        blob[self._hits_blob_key] = hits
        return blob
526464
def to_tuple(self):
        """"""
        return (
            self.data_type,
            self.unit,
            self.analysis_period,
            self.metadata
        )
848603
def _get_recording(self, index):
        """"""
        assert index >= 0
        recs = np.nonzero((index - self.offsets[:-1]) >= 0)[0]
        if len(recs) == 0:  # pragma: no cover
            # If the index is greater than the total size,
            # return the last recording.
            return len(self.arrs) - 1
        # Return the last recording such that the index is greater than
        # its offset.
        return recs[-1]
670366
def getAnalysis(self):
        
        analysis = None
        ans = self.getLinkedAnalyses()

        if len(ans) > 1:
            # Attachment is assigned to more than one Analysis. This might
            # happen when the AR was invalidated
            an_ids = ", ".join(map(api.get_id, ans))
            logger.info("Attachment assigned to more than one Analysis: [{}]. "
                        "The first Analysis will be returned".format(an_ids))

        if len(ans) >= 1:
            analysis = ans[0]

        return analysis
1350033
def filter_by_analysis_period(self, analysis_period):
        
        self._check_analysis_period(analysis_period)
        _filtered_data = self.filter_by_doys(analysis_period.doys_int)
        _filtered_data.header._analysis_period = analysis_period
        return _filtered_data
244780
def cull_to_timestep(self, timestep=1):
        """"""
        valid_s = self.header.analysis_period.VALIDTIMESTEPS.keys()
        assert timestep in valid_s, \
            'timestep {} is not valid. Choose from: {}'.format(timestep, valid_s)

        new_ap, new_values, new_datetimes = self._timestep_cull(timestep)
        new_header = self.header.duplicate()
        new_header._analysis_period = new_ap
        new_coll = HourlyDiscontinuousCollection(
            new_header, new_values, new_datetimes)
        new_coll._validated_a_period = True
        return new_coll
1097151
def access_time(self):
    """"""
    if self._stat_info is None:
      return None

    timestamp = int(self._stat_info.st_atime)
    return dfdatetime_posix_time.PosixTime(timestamp=timestamp)
359869
def get_scheduled_analyses(self):
        
        url = '{}scheduled_analyses/'.format(self.url)
        return ScheduledAnalysis._get_list_from_url(url, append_base_url=False)
825518
def assigned_state(instance):
    
    analyses = instance.getAnalyses()
    if not analyses:
        return "unassigned"
    for analysis in analyses:
        analysis_object = api.get_object(analysis)
        if not analysis_object.getWorksheet():
            return "unassigned"
    return "assigned"
1216022
def is_continuous(self):
        """"""
        if self._validated_a_period is True and \
                len(self.values) == len(self.header.analysis_period.months_int):
            return True
        else:
            return False