ProteoWizard
TruncatedLorentzianParameters.hpp
Go to the documentation of this file.
1 //
2 // $Id: TruncatedLorentzianParameters.hpp 1191 2009-08-14 19:33:05Z chambm $
3 //
4 //
5 // Original author: Darren Kessner <darren@proteowizard.org>
6 //
7 // Copyright 2006 Louis Warschaw Prostate Cancer Center
8 // Cedars Sinai Medical Center, Los Angeles, California 90048
9 //
10 // Licensed under the Apache License, Version 2.0 (the "License");
11 // you may not use this file except in compliance with the License.
12 // You may obtain a copy of the License at
13 //
14 // http://www.apache.org/licenses/LICENSE-2.0
15 //
16 // Unless required by applicable law or agreed to in writing, software
17 // distributed under the License is distributed on an "AS IS" BASIS,
18 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 // See the License for the specific language governing permissions and
20 // limitations under the License.
21 //
22 
23 
24 #ifndef _TRUNCATEDLORENTZIANPARAMETERS_HPP_
25 #define _TRUNCATEDLORENTZIANPARAMETERS_HPP_
26 
27 
29 #include "TruncatedLorentzian.hpp"
30 
31 
32 namespace pwiz {
33 namespace frequency {
34 
35 
36 /// struct for holding parameters for a Truncated Lorentzian function
38 {
39  double T;
40  double tau;
41  std::complex<double> alpha;
42  double f0;
43 
46  TruncatedLorentzianParameters(const std::string& filename);
47 
48  /// write out to file
49  void write(const std::string& filename) const;
50 
51  /// write samples to stream
52  void writeSamples(std::ostream& os) const;
53 
54  /// write samples to stream
55  void writeSamples(std::ostream& os,
56  double frequencyStart,
57  double frequencyStep,
58  int sampleCount) const;
59 
60  /// returns parameters in format usable by TruncatedLorentzian class
61  ublas::vector<double> parameters(double shift=0, std::complex<double> scale=1) const;
62 
63  /// reads in parameters from TruncatedLorentzian format
64  void parameters(const ublas::vector<double>& value, double shift=0, std::complex<double> scale=1);
65 };
66 
67 
68 PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, const TruncatedLorentzianParameters& tlp);
71 
72 
73 } // namespace frequency
74 } // namespace pwiz
75 
76 
77 #endif // _TRUNCATEDLORENTZIANPARAMETERS_HPP_
78