def getTransitionProbabilities(s, x, F, a):
    """Calculate the transition probabilities for the given state and action.
    
    Parameters
    ----------
    s : float
        The probability of a population remaining in its current abundance
        class
    x : int
        The population abundance class
    F : int
        The number of years since a fire
    a : int
        The action to be performed
    
    Returns
    -------
    prob : array
        The transition probabilities as a vector from state (x, F) to every
        other state given action ``a`` is performed.
    
    """
    assert 0 <= x < POPULATION_CLASSES
    assert 0 <= F < FIRE_CLASSES
    assert 0 <= s <= 1
    assert 0 <= a < ACTIONS 
    prob = np.zeros((STATES,))
    r = getHabitatSuitability(F)
    # Efect of action on time in years since fire.
    if a == 0:
        # Increase the time since the patch has been burned by one year.
        # The years since fire in patch is absorbed into the last class
        if F < FIRE_CLASSES - 1:
            F += 1
    elif a == 1:
        # When the patch is burned set the years since fire to 0.
        F = 0
    elif a == 2:
        pass
    elif a == 3:
        pass
    # Population transitions
    if x == 0:
        # Demographic model probabilities
        # population abundance class stays at 0 (extinct)
        new_state = convertStateToIndex(0, F)
        prob[new_state] = 1
    elif x == POPULATION_CLASSES - 1:
        # Population abundance class either stays at maximum or transitions
        # down
        x_1 = x
        x_2 = x - 1
        # Effect of action on the state
        # If action 1 is taken, then the patch is burned so the population
        # abundance moves down a class.
        if a == 1:
            x_1 -= 1
            x_2 -= 1
        elif a == 2:
            pass
        elif a == 3:
            pass
        # Demographic model probabilities
        new_state = convertStateToIndex(x_1, F)
        prob[new_state] = 1 - (1 - s) * (1 - r) # abundance stays the same
        new_state = convertStateToIndex(x_2, F)
        prob[new_state] = (1 - s) * (1 - r) # abundance goes down
    else:
        # Population abundance class can stay the same, transition up, or
        # transition down.
        x_1 = x
        x_2 = x + 1
        x_3 = x - 1
        # Effect of action on the state
        # If action 1 is taken, then the patch is burned so the population
        # abundance moves down a class.
        if a == 1:
            x_1 -= 1
            x_2 -= 1
            # Ensure that the abundance class doesn't go to -1
            if x_3 > 0:
                x_3 -= 1
        elif a == 2:
            pass
        elif a == 3:
            pass
        # Demographic model probabilities
        new_state = convertStateToIndex(x_1, F)
        prob[new_state] = s # abundance stays the same
        new_state = convertStateToIndex(x_2, F)
        prob[new_state] = (1 - s) * r # abundance goes up
        new_state = convertStateToIndex(x_3, F)
        # In the case when x_3 = 0 before the effect of an action is applied,
        # then the final state is going to be the same as that for x_1, so we
        # need to add the probabilities together.
        prob[new_state] += (1 - s) * (1 - r) # abundance goes down
    return(prob)
Calculate the transition probabilities for the given state and action.
    
    Parameters
    ----------
    s : float
        The probability of a population remaining in its current abundance
        class
    x : int
        The population abundance class
    F : int
        The number of years since a fire
    a : int
        The action to be performed
    
    Returns
    -------
    prob : array
        The transition probabilities as a vector from state (x, F) to every
        other state given action ``a`` is performed.