<commit_before>######################################################################
# Copyright (C) 2011-2013 <NAME>
#
# This file is licensed under Version 3.0 of the GNU General Public
# License. See LICENSE for a text of the license.
######################################################################

######################################################################
# This file is part of BayesPy.
#
# BayesPy is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# BayesPy is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with BayesPy.  If not, see <http://www.gnu.org/licenses/>.
######################################################################


import os, sys
import tempfile

import numpy as np
import scipy.sparse as sp
import matplotlib.pyplot as plt
from matplotlib import animation
#from matplotlib.pyplot import *

from bayespy.inference.vmp.nodes.categorical import CategoricalStatistics

from bayespy.utils import utils

def timeseries_gaussian_mc(X, scale=2):
    """
    Parameters:
    X : node
        Node with Gaussian Markov chain moments.
    """
    timeseries_gaussian(X, axis=-2, scale=scale)
    
def timeseries_gaussian(X, axis=-1, scale=2):
    """
    Parameters:
    X : node
        Node with Gaussian moments.
    axis : int
        The index of the time axis.
    """
    u_X = X.get_moments()
    x = u_X[0]
    xx = u_X[1]
    std = scale * np.sqrt(np.einsum('...ii->...i', xx) - x**2)
    
    _timeseries_mean_and_error(x, std, axis=axis)
    
def timeseries_normal(X, axis=-1, scale=2):
    """
    Parameters:
    X : node
        Node with Gaussian moments.<commit_msg>ENH: Ensure Gaussian statistics when plotting a Gaussian variable<commit_after>######################################################################
# Copyright (C) 2011-2013 <NAME>
#
# This file is licensed under Version 3.0 of the GNU General Public
# License. See LICENSE for a text of the license.
######################################################################

######################################################################
# This file is part of BayesPy.
#
# BayesPy is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# BayesPy is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with BayesPy.  If not, see <http://www.gnu.org/licenses/>.
######################################################################


import os, sys
import tempfile

import numpy as np
import scipy.sparse as sp
import matplotlib.pyplot as plt
from matplotlib import animation
#from matplotlib.pyplot import *

from bayespy.inference.vmp.nodes.categorical import CategoricalStatistics
from bayespy.inference.vmp.nodes.gaussian import GaussianStatistics

from bayespy.utils import utils

def timeseries_gaussian_mc(X, scale=2):
    """
    Parameters:
    X : node
        Node with Gaussian Markov chain moments.
    """
    timeseries_gaussian(X, axis=-2, scale=scale)
    
def timeseries_gaussian(X, axis=-1, scale=2):
    """
    Parameters:
    X : node
        Node with Gaussian moments.
    axis : int
        The index of the time axis.
    """
    X = X._convert(GaussianStatistics)
    u_X = X.get_moments()
    x = u_X[0]
    xx = u_X[1]
    std = scale * np.sqrt(np.einsum('...ii->...i', xx) - x**2)
    
    _timeseries_mean_and_error(x, std, axis=axis)
    
def timeseries_normal(X, axis=-1, scale=2):
    """
    Parameters:
    X : node
        Node with Gaussian moments.
{'fraction_non_alphanumeric': 0.20874369445111698, 'fraction_numerical': 0.009608455440787894, 'mean_word_length': 3.881594372801876, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4763609', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1122, 'n_words': 429}