Changeset 13965
- Timestamp:
- Jun 24, 2007, 3:24:20 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/PS-IPP-Config/lib/PS/IPP/Metadata/Stats.pm (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/PS-IPP-Config/lib/PS/IPP/Metadata/Stats.pm
r13925 r13965 1 1 # Copyright (c) 2006 Paul Price, Joshua Hoblitt 2 2 # 3 # $Id: Stats.pm,v 1.1 4 2007-06-20 22:43:07 price Exp $3 # $Id: Stats.pm,v 1.15 2007-06-25 01:24:20 eugene Exp $ 4 4 5 5 package PS::IPP::Metadata::Stats; … … 24 24 25 25 use base qw( Class::Accessor::Fast ); 26 __PACKAGE__->mk_accessors( qw( bg_mean bg_stdev bg_mean_stdev fringe fringe_err26 __PACKAGE__->mk_accessors( qw( bg_mean bg_stdev bg_mean_stdev fringe_mean fringe_mean_stdev fringe_err 27 27 constants variables bg_data bg_stdev_data ) ); 28 28 … … 36 36 my $variables = shift; # Array of values that may be variable through the FPA 37 37 38 my $self = { bg_mean => undef, # Mean of the mean backgrounds 39 bg_stdev => undef, # Standard deviation of the mean backgrounds 40 bg_mean_stdev => undef, # Mean of the standard deviation of the backgrounds 41 fringe => [], # Fringe amplitudes 42 fringe_err => [], # Fringe amplitude errors 38 my $self = { bg_mean => undef, # Mean of the mean backgrounds 39 bg_stdev => undef, # Standard deviation of the mean backgrounds 40 bg_mean_stdev => undef, # Mean of the standard deviation of the backgrounds 41 fringe_mean => [], # Fringe amplitudes 42 fringe_err => [], # Fringe amplitude errors 43 fringe_mean_stdev => [], # Fringe amplitude errors 43 44 constants => $constants, # Array of values that should be constant through the FPA 44 45 variables => $variables, # Array of values that may be variable through the FPA 45 bg_data => [], # Array of background values46 bg_stdev_data => [], # Array of background standard deviations47 fringe_data => [], # Fringe amplitudes each component48 fringe_err_data => [], # Fringe errors for each component49 data => {} # The data50 };46 bg_data => [], # Array of background values 47 bg_stdev_data => [], # Array of background standard deviations 48 fringe_data => [], # Fringe amplitudes each component 49 fringe_err_data => [], # Fringe errors for each component 50 data => {} # The data 51 }; 51 52 52 53 # Populate object … … 77 78 my $errors = 0; 78 79 79 #$self->_parse_megacam($md);80 # $self->_parse_megacam($md); 80 81 $self->_parse_braindead($md); 81 82 … … 113 114 # Get mean, stdev, mean stdev for the background 114 115 if (scalar @{$self->{bg_data}} > 0) { 115 my $ meanStats = Statistics::Descriptive::Sparse->new(); # Statistics for mean116 $ meanStats->add_data(@{$self->{bg_data}});117 $self->bg_mean($ meanStats->mean());118 # XXX the stddev of a set of 1, appears to be a statistics undefined119 # value, however that doesn't do us much go so I'm changing undef to 0120 $self->bg_mean_stdev($meanStats->standard_deviation() || 0);116 my $stats = Statistics::Descriptive::Sparse->new(); # Statistics for mean 117 $stats->add_data(@{$self->{bg_data}}); 118 $self->bg_mean($stats->mean()); 119 $self->bg_mean_stdev($stats->standard_deviation() || 0); 120 # the stdev of a set of 1 is the undefined however that 121 # doesn't do us much good so I'm changing undef to 0 121 122 } else { 122 123 $self->bg_mean(undef); … … 124 125 } 125 126 if (scalar @{$self->{bg_stdev_data}} > 0) { 126 my $st devStats = Statistics::Descriptive::Sparse->new(); # Statistics for standard deviation127 my $stats = Statistics::Descriptive::Sparse->new(); # Statistics for standard deviation 127 128 my @variances; 128 129 foreach my $number (@{$self->{bg_stdev_data}}) { 129 130 push @variances, $number**2; 130 131 } 131 $st devStats->add_data(@variances);132 $self->bg_stdev( sqrt( $st devStats->mean() ) );132 $stats->add_data(@variances); 133 $self->bg_stdev( sqrt( $stats->mean() ) ); 133 134 } else { 134 135 $self->bg_stdev(undef); … … 140 141 my $stats = Statistics::Descriptive::Sparse->new(); # Statistics calculator 141 142 $stats->add_data(@$array); 142 push @{$self->{fringe}}, $stats->mean(); 143 push @{$self->{fringe_mean}}, $stats->mean(); 144 push @{$self->{fringe_mean_stdev}}, ($stats->standard_deviation() || 0); 145 # the stdev of a set of 1 is the undefined however that 146 # doesn't do us much good so I'm changing undef to 0 143 147 } 144 148 }
Note:
See TracChangeset
for help on using the changeset viewer.
