-
Notifications
You must be signed in to change notification settings - Fork 0
/
Wave.h
118 lines (103 loc) · 4.17 KB
/
Wave.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//
// Wave.h
// iGDDS
//
// Created by Roberto Abraham on Tue Dec 31 2002.
// Copyright (c) 2002 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
// Categories
#import "BAStringUtilities.h"
// Drawing routines
#import "PlotView.h"
// the following are needed to support fits stuff
#include <string.h>
#include <stdlib.h>
#include "fitsio.h"
#include "fits.h"
// some compile-time settings
#define NMAXCOEFFS 10
#define BADVAL -99999.99
void legendreP(long n, double x, double *p);
void locate(double *xx, long n, double x, long *j);
double *readspectrum(char *filename, int *nx, long *p0, double *pMin, double *pMax, double cf[NMAXCOEFFS],long *ncf, int *error_status);
@interface Wave : NSObject <NSCoding, NSCopying>
{
PlotView *_view;
NSMutableData *_y; /* collection of double precision points */
NSMutableData *_x; /* collection of double precision abscissae (explicit or computed & cached) */
NSMutableData *_c; /* coefficients of Legendre polynomial describing the WCS */
long _n; /* number of data points */
long _order; /* order of legendre polynomial */
long _p0; /* physical coordinate of first point (an offset usually set to 0) */
double _pMin; /* lower limit of normalizing physical coordinate */
double _pMax; /* upper limit of normalizing physical coordinate */
double _xMin; /* minimum stored x value */
double _xMax; /* maximum stored x value */
NSMutableDictionary *_attributes; /* store anything you want here */
}
-(id)initWithZerosUsingN:(int)n startX:(double)x0 dX:(double)dx offset:(long)p0;
-(id)initWithLinearScale:(double *)ypts nData:(int)n startX:(double)x0 dX:(double)dx offset:(long)p0;
-(id)initWithNonLinearScale:(double *)ypts nData:(int)n coefficients:(double *)legendre order:(long)order offset:(long)p0 pMin:(double)pMin pMax:(double)pMax;
-(id)initWithFITS:(NSString *)file;
-(id)initWithGrid:(double *)xpts y:(double *)ypts nData:(int)n offset:(long)p0;
-(id)initWithTextFile:(NSString *)path xColumn:(int)xcol yColumn:(int)ycol;
-(int)saveAsFITS:(NSString *)file;
-(double)xAtIndexSlow:(long)i;
-(double)xAtIndex:(long)i;
-(double)yAtIndex:(long)i;
-(double)yAtX:(double)x outOfRangeValue:(double)outval;
-(double)dindexAtX:(double)x outOfRangeValue:(double)outval;
-(void) resampleToMatch:(Wave *)w outOfRangeValue:(double)outval;
-(Wave *)duplicate;
-(void)setScaleWithX0:(double)x0 dX:(double)dx p0:(long)p0;
-(void)setScaleWithCoefficients:(NSMutableData *)coeff order:(long) order p0:(long)p0 pMin:(double)pMin pMax:(double)pMax;
-(void)ramp;
-(void)localGridInPlace;
-(void)cacheAbscissae;
//Arithmetic
-(void)multiplyByScalar:(double)v;
-(void)multiplyByWave:(Wave *)w outOfRangeValue:(double)outval;
-(void)addScalar:(double)v;
-(void)addWave:(Wave *)w outOfRangeValue:(double)outval;
-(void)abs;
-(void)tenToThePower;
-(void)invert;
//Statistics
-(void)boxcar:(int)halfWidth;
-(double)meanInRangeFromX:(double)x0 toX:(double)x1;
-(double)standardDeviationInRangeFromX:(double)x0 toX:(double)x1;
-(double)signalToNoiseInRangeFromX:(double)x0 toX:(double)x1;
-(double)sumInRangeFromX:(double)x0 toX:(double)x1;
-(double)medianInRangeFromX:(double)x0 toX:(double)x1;
-(double)yMaxInRangeFromX:(double)x0 toX:(double)x1 outOfRange:(double)outval;
-(double)yMinInRangeFromX:(double)x0 toX:(double)x1 outOfRange:(double)outval;
-(double)yMin;
-(double)yMax;
-(void)mapGaussianWithSigma:(double)sigma mu:(double)mu;
//Drawing
-(void)plotWithTransform:(NSAffineTransform *)trans;
-(PlotView *)myView;
-(void)setMyView:(PlotView *)v;
-(BOOL)showMe;
-(void)setShowMe:(BOOL)val;
//Accessor methods
-(long)n;
-(long)order;
-(long)p0;
-(double)pMin;
-(double)pMax;
-(double)xMin;
-(double)xMax;
-(NSMutableData *)y;
-(NSMutableData *)c;
-(NSMutableData *)x;
-(NSMutableDictionary *)attributes;
-(void)setY:(NSMutableData *)y;
-(void)setC:(NSMutableData *)c;
-(void)setX:(NSMutableData *)x;
-(void)setP0:(long)p0;
-(void)setPMin:(double)pMin;
-(void)setPMax:(double)pMax;
-(void)setAttributes:(NSMutableDictionary *)attrs;
@end