cengal.user_interface.plot.versions.v_0.plot
1#!/usr/bin/env python 2# coding=utf-8 3 4# Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space> 5# 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17 18__all__ = ['plot'] 19 20import numpy as np 21import matplotlib.pyplot as pyplot 22from typing import Optional 23 24""" 25Module Docstring 26Docstrings: http://www.python.org/dev/peps/pep-0257/ 27""" 28 29__author__ = "ButenkoMS <gtalk@butenkoms.space>" 30__copyright__ = "Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>" 31__credits__ = ["ButenkoMS <gtalk@butenkoms.space>", ] 32__license__ = "Apache License, Version 2.0" 33__version__ = "4.4.1" 34__maintainer__ = "ButenkoMS <gtalk@butenkoms.space>" 35__email__ = "gtalk@butenkoms.space" 36# __status__ = "Prototype" 37__status__ = "Development" 38# __status__ = "Production" 39 40 41def plot(amplitude_axis: np.ndarray, title=str(), xlabel=str(), ylabel=str(), psd: bool=False, nfft: Optional[int]=None, samples_per_time_unit: Optional[int]=None): 42 time_axis = np.arange(0, len(amplitude_axis)) 43 if psd: 44 pyplot.subplot(211) 45 pyplot.plot(time_axis, amplitude_axis) 46 pyplot.title(title) 47 pyplot.xlabel(xlabel) 48 pyplot.ylabel(ylabel) 49 pyplot.grid(True, which='both') 50 pyplot.axhline(y=0, color='k') 51 if psd: 52 pyplot.subplot(212) 53 pyplot.psd(amplitude_axis, nfft, samples_per_time_unit) 54 pyplot.show()
def
plot( amplitude_axis: numpy.ndarray, title='', xlabel='', ylabel='', psd: bool = False, nfft: Union[int, NoneType] = None, samples_per_time_unit: Union[int, NoneType] = None):
42def plot(amplitude_axis: np.ndarray, title=str(), xlabel=str(), ylabel=str(), psd: bool=False, nfft: Optional[int]=None, samples_per_time_unit: Optional[int]=None): 43 time_axis = np.arange(0, len(amplitude_axis)) 44 if psd: 45 pyplot.subplot(211) 46 pyplot.plot(time_axis, amplitude_axis) 47 pyplot.title(title) 48 pyplot.xlabel(xlabel) 49 pyplot.ylabel(ylabel) 50 pyplot.grid(True, which='both') 51 pyplot.axhline(y=0, color='k') 52 if psd: 53 pyplot.subplot(212) 54 pyplot.psd(amplitude_axis, nfft, samples_per_time_unit) 55 pyplot.show()