docs: def calculate_activity_rate(self, strain_data, cumulative=False,
                                  in_seconds=False):
          '''
          Main function to calculate the activity rate (for each of the
          magnitudes in target_magnitudes) for all of the cells specified in
          the input strain model file
  
          :param strain_data:
              Strain model as an instance of :class:
              openquake.hmtk.strain.geodetic_strain.GeodeticStrain
  
          :param bool cumulative:
              Set to true if the cumulative rate is required, False for
              incremental
  
          :param bool in_seconds:
              Returns the activity rate in seconds (True) or else as an annual
              activity rate
          '''
          self.strain = strain_data
          self.strain.target_magnitudes = self.target_magnitudes
          # Adjust strain rates from annual to seconds (SI)
          for key in STRAIN_VARIABLES:
              self.strain.data[key] = self.strain.data[key] / SECS_PER_YEAR
  
          if 'region' not in self.strain.data:
              raise ValueError('Cannot implment  SHIFT methodology without '
                               'definition of regionalisation')
          else:
              self._reclassify_Bird_regions_with_data()
  
          # Initially all seismicity rates assigned to background rate
          self.strain.seismicity_rate = np.tile(
              self.base_rate,
              [self.strain.get_number_observations(), 1])
  
          regionalisation_zones = (
              np.unique(self.strain.data['region'])).tolist()
  
          for region in regionalisation_zones:
              id0 = self.strain.data['region'] == region
              if b'IPL' in region:
                  # For intra-plate seismicity everything is refered to
                  # the background rate
                  continue
  
              elif b'OSR_special_1' in region:
                  # Special case 1 - normal and transform faulting
                  calculated_rate = self.get_rate_osr_normal_transform(
                      self.threshold_moment, id0)
  
              elif b'OSR_special_2' in region:
                  # Special case 2 - convergent and transform faulting
                  calculated_rate = self.get_rate_osr_convergent_transform(
                      self.threshold_moment, id0)
              else:
                  region = region.decode('utf-8')
                  calculated_rate = \
                      self.regionalisation[region]['adjustment_factor'] * \
                      self.continuum_seismicity(self.threshold_moment,
                                                self.strain.data['e1h'][id0],
                                                self.strain.data['e2h'][id0],
                                                self.strain.data['err'][id0],
                                                self.regionalisation[region])
  
              for jloc, iloc in enumerate(np.where(id0)[0]):
                  # Where the calculated rate exceeds the base rate then becomes
                  # calculated rate. In this version the magnitudes are treated
                  # independently (i.e. if Rate(M < 7) > Base Rate (M < 7) but
                  # Rate (M > 7) < Base Rate (M > 7) then returned Rate (M < 7)
                  # = Rate (M < 7) and returned Rate (M > 7) = Base Rate (M > 7)
                  id1 = calculated_rate[jloc] > self.base_rate
                  self.strain.seismicity_rate[iloc, id1] = calculated_rate[jloc,
                                                                           id1]
  
          if not cumulative and self.number_magnitudes > 1:
              # Seismicity rates are currently cumulative - need to turn them
              # into discrete
              for iloc in range(0, self.number_magnitudes - 1):
                  self.strain.seismicity_rate[:, iloc] = \
                      self.strain.seismicity_rate[:, iloc] -\
                      self.strain.seismicity_rate[:, iloc + 1]
  
          if not in_seconds:
              self.strain.seismicity_rate = self.strain.seismicity_rate * \
                  SECS_PER_YEAR
  
              for key in STRAIN_VARIABLES:
                  self.strain.data[key] = self.strain.data[key] * SECS_PER_YEAR