code: def make_component(season_tuple, frequency, num_steps, min_cycles=2):
      """Make a seasonal component from a template component.
  
      This is a helper function to the _create_seasonal_structure() method. It
      takes a SeasonConversion instance from _SEASONAL_PROTOTYPES and
      creates a seasonal component based on the number of observations
      `num_steps` in the data and the time series frequency `freq_sec`. A
      custom seasonal component is created if it fulfills 4 conditions:
        Condition 1: time series must cover at least _MIN_CYCLES full cycles.
        Condition 2: full cycle must be a multiple of the granularity.
        Condition 3: if the season is longer than the granularity, it must be a
          multiple of the granularity.
        Condition 4: number of seasons must be greater than 1.
  
      Args:
        season_tuple: an `SeasonConversion` instance the number of
          seasons, and season duration for a template seasonal component e.g.
          (60, 1) for seconds-of-minute or (60, 60) for minute-of-hour.
          See _SEASONAL_PROTOTYPES for more details.
        frequency: a `pd.DateOffset` instance.
        num_steps: Python `int` number of steps at the given frequency.
        min_cycles: Python `int` minimum number of cycles to include an effect.
  
      Returns:
        An `SeasonConversion` instance, where num and duration
        is the inferred structure for the seasonal component. If a seasonal
        component can not be created it returns None for that component.
      """
      freq_sec = freq_to_seconds(frequency)
      if not freq_sec:
          return None
  
      num_seasons = season_tuple.num
      duration_seconds = season_tuple.duration
      #  None component returned if no component can be created below.
      component = None
      # Condition 1: time series must cover at least _MIN_CYCLES full cycles.
      minimum_observations = (
          num_seasons * duration_seconds * min_cycles
      ) / freq_sec
      cond1 = num_steps >= minimum_observations
  
      # Condition 2: full cycle must be a multiple of the granularity.
      cond2 = (num_seasons * duration_seconds) % freq_sec == 0
      # Condition 3: if the season is longer than the granularity, it must be a
      # multiple of the granularity.
      cond3 = (duration_seconds <= freq_sec) or (
          duration_seconds % freq_sec == 0
      )
      if cond1 and cond2 and cond3:
          nseasons = min(
              num_seasons * duration_seconds / freq_sec, num_seasons
          )
          season_duration = max(duration_seconds / freq_sec, 1)
          # Condition 4: number of seasons must be greater than 1.
          cond4 = (nseasons > 1) and (nseasons <= num_seasons)
          if cond4:
              component = SeasonConversion(
                  num=int(nseasons), duration=int(season_duration)
              )
      return component
  
file_path: probability/tensorflow_probability/python/sts/internal/seasonality_util.py
imports: import collections
  import enum
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import prefer_static
label_desc: Use image node_id 2 for calling a global function with example usage: make_component(season_tuple, frequency, num_steps, min_cycles) and returns: component, None