docs: def is_valid_intensity_measure_types(self):
          """
          If the IMTs and levels are extracted from the risk models,
          they must not be set directly. Moreover, if
          `intensity_measure_types_and_levels` is set directly,
          `intensity_measure_types` must not be set.
          """
          if self.ground_motion_correlation_model:
              for imt in self.imtls:
                  if not (imt.startswith('SA') or imt == 'PGA'):
                      raise ValueError(
                          'Correlation model %s does not accept IMT=%s' % (
                              self.ground_motion_correlation_model, imt))
          if self.risk_files:  # IMTLs extracted from the risk files
              return (self.intensity_measure_types is None and
                      self.intensity_measure_types_and_levels is None)
          elif not hasattr(self, 'hazard_imtls') and not hasattr(
                  self, 'risk_imtls'):
              return False
          return True