Commit 98202b7a authored by thomas.forbriger's avatar thomas.forbriger
Browse files

libpsdxx [WP]: handle parameter values

parent 13ecf49b
/*! \file dpsdcomputer_parameters.cc
* \brief handle parameters for DPSDComputer (implementation)
*
* ----------------------------------------------------------------------------
*
* \author Thomas Forbriger
* \date 03/01/2019
*
* handle parameters for DPSDComputer (implementation)
*
* Copyright (c) 2019 by Thomas Forbriger (BFO Schiltach)
*
* ----
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
* ----
*
* REVISIONS and CHANGES
* - 03/01/2019 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define PSDXX_DPSDCOMPUTER_PARAMETERS_CC_VERSION \
"PSDXX_DPSDCOMPUTER_PARAMETERS_CC V1.0"
#include <psdxx/psd.h>
#include <psdxx/error.h>
namespace psd {
void DPSDComputer::set_nsegments(const unsigned int& n)
{
PSDXX_assert(n>0, "number of segments must be finite");
this->Mnsegments=n;
} // void DPSDComputer::set_nsegments(const unsigned int& n)
/* ---------------------------------------------------------------------- */
void DPSDComputer::set_divisor(const unsigned int& n)
{
PSDXX_assert(n>0, "divisor must be finite");
this->Mdivisor=n;
} // void DPSDComputer::set_divisor(const unsigned int& n)
/* ---------------------------------------------------------------------- */
void DPSDComputer::set_npadding(const unsigned int& n)
{
PSDXX_assert(n>0, "padding factor must be finite");
this->Mnpadding=n;
} // void DPSDComputer::set_npadding(const unsigned int& n)
/* ---------------------------------------------------------------------- */
void DPSDComputer::set_overlap(const double& f)
{
PSDXX_assert(f>=0., "overlap fraction must be positive");
PSDXX_assert(f<0.5, "overlap fraction is too large");
this->Moverlap=f
} // void DPSDComputer::set_overlap(const double& f)
/* ---------------------------------------------------------------------- */
void DPSDComputer::set_verbose(const bool& f)
{
this->Mverbose=f;
} // void DPSDComputer::set_verbose(const bool& f)
} // namespace psd
/* ----- END OF dpsdcomputer_parameters.cc ----- */
......@@ -91,6 +91,23 @@ namespace psd {
class DPSDComputer
{
public:
//! default constructor
DPSDComputer():
Mnsegments(1), Moverlap(0.), Mdivisor(1), Mnpadding(1),
Mverbose(false) { }
void set_nsegments(const unsigned int& n);
void set_divisor(const unsigned int& n);
void set_npadding(const unsigned int& n);
void set_overlap(const double& f);
void set_verbose(const bool& f);
unsigned int nsegments() const { return(Mnsegments); }
unsigned int divisor() const { return(Mdivisor); }
unsigned int npadding() const { return(Mnpadding); }
double overlap() const { return(Moverlap); }
bool verbose() const { return(Mverbose); }
//! compute power spectral density
Tdouble_series psd(const Tdouble_series& s) const;
//! compute cross power spectrum
......@@ -109,6 +126,8 @@ namespace psd {
unsigned int Mdivisor;
//! factor to increase size of time series by zero-padding
unsigned int Mnpadding;
//! produce verbose output on terminal
bool Mverbose;
}; // class DPSDComputer
/* ====================================================================== */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment