Skip to content
Snippets Groups Projects
Commit 35ed5db6 authored by Andre Offringa's avatar Andre Offringa
Browse files

Bug 1491: Fix of installation errors reported by A. Schoenmakers.

parent 07b8283a
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,6 @@ install(FILES
gui/imagewidget.h
gui/msoptionwindow.h
gui/mswindow.h
gui/newstrategyactionframe.h
gui/plotframe.h
gui/progresswindow.h
gui/rawoptionwindow.h
......@@ -61,7 +60,6 @@ install(FILES
gui/strategyframes/spatialcompositionframe.h
gui/strategyframes/statisticalflaggingframe.h
gui/strategyframes/svdframe.h
gui/strategyframes/thresholdframe.h
gui/strategyframes/timeconvolutionframe.h
gui/strategyframes/timeselectionframe.h
gui/strategyframes/uvprojectframe.h
......@@ -124,7 +122,6 @@ install(FILES
strategy/actions/statisticalflagaction.h
strategy/actions/strategyaction.h
strategy/actions/svdaction.h
strategy/actions/thresholdaction.h
strategy/actions/timeselectionaction.h
strategy/actions/uvprojectaction.h
strategy/actions/writedataaction.h
......
......@@ -22,10 +22,6 @@
#include <string>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_multifit_nlin.h>
/**
@author A.R. Offringa <offringa@astro.rug.nl>
*/
......@@ -77,30 +73,30 @@ private:
void WindowSquare(unsigned scanIndex, unsigned frequencyIndex);
// This function calculates the sum of the squared errors when the parameters in 'x' are used.
static int BaselineFunction(const gsl_vector * x, void *data, gsl_vector * f);
//static int BaselineFunction(const gsl_vector * x, void *data, gsl_vector * f);
// This function calculates the sum of the squared errors when the parameters in 'x' are used.
static int BaselineFunctionMPF(const gsl_vector * x, void *data, gsl_vector * f);
//static int BaselineFunctionMPF(const gsl_vector * x, void *data, gsl_vector * f);
// This function calculates the Jacobian matrix of "BaselineFunction()".
static int BaselineDerivative(const gsl_vector * x, void *data, gsl_matrix * J);
//static int BaselineDerivative(const gsl_vector * x, void *data, gsl_matrix * J);
// This function calculates the Jacobian matrix of "BaselineFunction()".
static int BaselineDerivativeMPF(const gsl_vector * x, void *data, gsl_matrix * J);
//static int BaselineDerivativeMPF(const gsl_vector * x, void *data, gsl_matrix * J);
static int BaselineCombined(const gsl_vector * x, void *data, gsl_vector * f, gsl_matrix * J)
/*static int BaselineCombined(const gsl_vector * x, void *data, gsl_vector * f, gsl_matrix * J)
{
BaselineFunction(x, data, f);
BaselineDerivative(x, data, J);
return GSL_SUCCESS;
}
}*/
static int BaselineCombinedMPF(const gsl_vector * x, void *data, gsl_vector * f, gsl_matrix * J)
/8static int BaselineCombinedMPF(const gsl_vector * x, void *data, gsl_vector * f, gsl_matrix * J)
{
BaselineFunctionMPF(x, data, f);
BaselineDerivativeMPF(x, data, J);
return GSL_SUCCESS;
}
}*/
//void PrintState(unsigned iter, gsl_multifit_fdfsolver *solver);
};
......
......@@ -21,11 +21,8 @@ class InterpolateNansAlgorithms
}
}
}
if(count > 0)
{
AOLogger::Debug << "Number of nans: " << count << '\n';
}
}
};
#endif // INTERPOLATENANSALGORITHM_H
......@@ -74,6 +74,14 @@ void runMaster()
// std::cout << "Resource " << i << " is released" << std::endl;
setReadLock(copy, i, readLock(memptr, i));
}
if(writeLock(copy, i) != writeLock(memptr, i))
{
if(writeLock(memptr, i) != 0)
std::cout << "Resource " << i << " is uniquely locked" << std::endl;
//else
// std::cout << "Resource " << i << " is uniquely released" << std::endl;
setWriteLock(copy, i, writeLock(memptr, i));
}
}
}
mutex.remove(MUTEX_NAME);
......@@ -188,7 +196,10 @@ int main(int argc, char *argv[])
else if(operation == "release" && argc >= 3) runRelease(atoi(argv[2]));
else if(operation == "release-unique" && argc >= 3) runReleaseUnique(atoi(argv[2]));
else if(operation == "clean") runClean();
else printError(argv[0]);
else {
cerr << "Unknown operation: " << operation << "\n";
printError(argv[0]);
}
}
}
#else
......
......@@ -71,7 +71,7 @@ void TimestepAccessor::Open()
else
_currentRow = _totalRowCount;
_endRow = _totalRowCount;
_bufferSize = 10000;
_bufferSize = 20000;
_readBuffer = new BufferItem[_bufferSize];
_readBufferPtr = 0;
_inReadBuffer = 0;
......@@ -123,7 +123,10 @@ bool TimestepAccessor::ReadNext(TimestepAccessor::TimestepIndex &index, Timestep
void TimestepAccessor::openSet(TimestepAccessor::SetInfo &set, bool update)
{
std::ostringstream s;
s << "ssh node079 -C \"~/LOFAR-build/aosynchronisation lock \"" << set.index << " 2> /dev/null\n";
if(update)
s << "ssh node079 -C \"~/LOFAR-build/bin/aosynchronisation lock-unique \"" << set.index << " 2> /dev/null\n";
else
s << "ssh node079 -C \"~/LOFAR-build/bin/aosynchronisation lock-unique \"" << set.index << " 2> /dev/null\n";
std::string str = s.str();
system(str.c_str());
......@@ -163,6 +166,7 @@ void TimestepAccessor::closeSet(TimestepAccessor::SetInfo &set)
delete set.antenna1Column;
delete set.antenna2Column;
delete set.timeColumn;
bool update = set.updateDataColumn != 0;
if(set.dataColumn != 0)
delete set.dataColumn;
if(set.updateDataColumn != 0)
......@@ -171,7 +175,10 @@ void TimestepAccessor::closeSet(TimestepAccessor::SetInfo &set)
delete set.table;
std::ostringstream s;
s << "ssh node079 -C \"~/LOFAR-build/aosynchronisation release \"" << set.index << " 2> /dev/null\n";
if(update)
s << "ssh node079 -C \"~/LOFAR-build/bin/aosynchronisation release-unique \"" << set.index << " 2> /dev/null\n";
else
s << "ssh node079 -C \"~/LOFAR-build/bin/aosynchronisation release-unique \"" << set.index << " 2> /dev/null\n";
std::string str = s.str();
system(str.c_str());
}
......@@ -213,7 +220,21 @@ bool TimestepAccessor::fillReadBuffer()
}
else {
if(data.timestep != ((*set.timeColumn)(row)))
throw TimestepAccessorException("Sets do not have same time steps");
{
std::stringstream s;
bool onlyWarn;
double thisTimestep = (*set.timeColumn)(row);
if(fabs(data.timestep - (*set.timeColumn)(row)) < 1e-3)
onlyWarn = true;
else
onlyWarn = false;
s << "Sets do not have equal time steps; first set has " << data.timestep << " while set " << set.index << " has " << thisTimestep << " (row=" << row << ", difference=" << (data.timestep-thisTimestep) << ")";
if(onlyWarn)
std::cout << "WARNING: " << s.str() << "\nIgnoring difference because it is < 1e-3\n";
else
throw TimestepAccessorException(s.str());
}
if(data.antenna1 != (unsigned) ((*set.antenna1Column)(row)))
throw TimestepAccessorException("Sets do not have same antenna1 ordering");
if(data.antenna2 != (unsigned) ((*set.antenna2Column)(row)))
......
......@@ -27,9 +27,6 @@
#include <AOFlagger/strategy/algorithms/thresholdmitigater.h>
#include <gsl/gsl_blas.h>
//#include <gmp.h>
#include <iostream>
#include <math.h>
......@@ -95,197 +92,6 @@ void ImageTile::ConvolveWindows()
delete oldWindows;
}
int ImageTile::BaselineFunction(const gsl_vector * x, void *data, gsl_vector * f)
{
ImageTile *tile = (ImageTile *) data;
for(unsigned channel=0; channel<tile->_channelCount; ++channel) {
for(unsigned scan=0; scan<tile->_scanCount; ++scan) {
unsigned f_index = channel + scan*tile->_channelCount;
if(tile->_isWindowed[channel][scan]) {
gsl_vector_set(f, f_index, 0.0);
} else {
long double term = gsl_vector_get(x, 0) - tile->GetValueAt(channel, scan);
for(int j=1;j <= tile->_freqOrder;++j)
term += gsl_vector_get(x, j) * pow((long double) channel, (long double) j);
for(int j=1;j <= tile->_timeOrder;++j)
term += gsl_vector_get(x, j + tile->_freqOrder) * pow((long double) scan, (long double) j);
gsl_vector_set(f, f_index, term * term);
}
}
}
return GSL_SUCCESS;
}
/*
int ImageTile::BaselineFunctionMPF(const gsl_vector * x, void *data, gsl_vector * f)
{
ImageTile *tile = (ImageTile *) data;
mpf_t term, tmpA, tmpB;
mpf_init(term);
mpf_init(tmpA);
mpf_init(tmpB);
for(unsigned channel=0; channel<tile->_channelCount; ++channel) {
for(unsigned scan=0; scan<tile->_scanCount; ++scan) {
unsigned f_index = channel + scan*tile->_channelCount;
if(tile->_isWindowed[channel][scan]) {
gsl_vector_set(f, f_index, 0.0);
} else {
mpf_set_d(tmpA, gsl_vector_get(x,0));
mpf_set_d(tmpB, tile->GetValueAt(channel, scan));
mpf_sub(term, tmpA, tmpB);
for(int j=1;j <= tile->_freqOrder;++j) {
// term += gsl_vector_get(x, j) * pow((long double) channel, (long double) j);
mpf_set_ui(tmpA, channel);
mpf_pow_ui(tmpA, tmpA, j);
mpf_set_d(tmpB, gsl_vector_get(x, j));
mpf_mul(tmpA, tmpA, tmpB);
mpf_add(term, term, tmpA);
}
for(int j=1;j <= tile->_timeOrder;++j) {
// term += gsl_vector_get(x, j + tile->_freqOrder) * pow((long double) scan, (long double) j);
mpf_set_ui(tmpA, scan);
mpf_pow_ui(tmpA, tmpA, j);
mpf_set_d(tmpB, gsl_vector_get(x, j + tile->_freqOrder));
mpf_mul(tmpA, tmpA, tmpB);
mpf_add(term, term, tmpA);
}
// term = term*term
mpf_mul(term, term, term);
gsl_vector_set(f, f_index, mpf_get_d(term));
}
}
}
mpf_clear(term);
mpf_clear(tmpA);
mpf_clear(tmpB);
return GSL_SUCCESS;
}*/
int ImageTile::BaselineDerivative(const gsl_vector * x, void *data, gsl_matrix * J)
{
ImageTile *tile = (ImageTile *) data;
long double factor = 0.0;
for(unsigned channel=0; channel<tile->_channelCount; ++channel) {
for(unsigned scan=0; scan<tile->_scanCount; ++scan) {
unsigned f_index = channel + scan*tile->_channelCount;
if(tile->_isWindowed[channel][scan]) {
for(int h = 1; h <= tile->_freqOrder ; ++h) {
gsl_matrix_set(J, f_index, h, 0.0);
}
} else {
long double term = gsl_vector_get(x, 0) - tile->GetValueAt(channel, scan);
for(int j=1;j <= tile->_freqOrder;++j)
term += gsl_vector_get(x, j) * pow((long double) channel, (long double) j);
for(int j=1;j <= tile->_timeOrder;++j)
term += gsl_vector_get(x, j + tile->_freqOrder) * pow((long double) scan, (long double) j);
factor = 2.0 * term;
long double value = factor;
gsl_matrix_set(J, f_index, 0, value);
for(int h = 1; h <= tile->_freqOrder ; ++h) {
value = factor * pow((long double) channel, (long double) h);
gsl_matrix_set(J, f_index, h, value);
}
for(int h = 1; h <= tile->_timeOrder ; ++h) {
value = factor * pow((long double) scan, (long double) h);
gsl_matrix_set(J, f_index, h + tile->_freqOrder, value);
}
}
}
}
return GSL_SUCCESS;
}
/*
int ImageTile::BaselineDerivativeMPF(const gsl_vector * x, void *data, gsl_matrix * J)
{
ImageTile *tile = (ImageTile *) data;
mpf_t factor, term, tmpA, tmpB;
mpf_init(factor);
mpf_init(term);
mpf_init(tmpA);
mpf_init(tmpB);
for(unsigned channel=0; channel<tile->_channelCount; ++channel) {
for(unsigned scan=0; scan<tile->_scanCount; ++scan) {
unsigned f_index = channel + scan*tile->_channelCount;
if(tile->_isWindowed[channel][scan]) {
for(int h = 1; h <= tile->_freqOrder ; ++h) {
gsl_matrix_set(J, f_index, h, 0.0);
}
} else {
// term = gsl_vector_get(x, 0) - tile->GetValueAt(channel, scan);
mpf_set_d(term, gsl_vector_get(x, 0));
mpf_set_d(tmpA, tile->GetValueAt(channel, scan));
mpf_sub(term, term, tmpA);
for(int j=1;j <= tile->_freqOrder;++j) {
// term += gsl_vector_get(x, j) * pow((long double) channel, (long double) j);
mpf_set_ui(tmpA, channel);
mpf_pow_ui(tmpA, tmpA, j);
mpf_set_d(tmpB, gsl_vector_get(x, j));
mpf_mul(tmpA, tmpA, tmpB);
mpf_add(term, term, tmpA);
}
for(int j=1;j <= tile->_timeOrder;++j) {
// term += gsl_vector_get(x, j + tile->_freqOrder) * pow((long double) scan, (long double) j);
mpf_set_ui(tmpA, scan);
mpf_pow_ui(tmpA, tmpA, j);
mpf_set_d(tmpB, gsl_vector_get(x, j + tile->_freqOrder));
mpf_mul(tmpA, tmpA, tmpB);
mpf_add(term, term, tmpA);
}
// factor = 2.0 * term;
mpf_set(factor, term);
mpf_mul_ui(factor, factor, 2);
gsl_matrix_set(J, f_index, 0, mpf_get_d(factor));
for(int h = 1; h <= tile->_freqOrder ; ++h) {
// value = factor * pow((long double) channel, (long double) h);
mpf_set_ui(tmpA, channel);
mpf_pow_ui(tmpA, tmpA, h);
mpf_mul(tmpA, factor, tmpA);
gsl_matrix_set(J, f_index, h, mpf_get_d(tmpA));
}
for(int h = 1; h <= tile->_timeOrder ; ++h) {
// value = factor * pow((long double) scan, (long double) h);
mpf_set_ui(tmpA, scan);
mpf_pow_ui(tmpA, tmpA, h);
mpf_mul(tmpA, factor, tmpA);
gsl_matrix_set(J, f_index, h + tile->_freqOrder, mpf_get_d(tmpA));
}
}
}
}
mpf_clear(factor);
mpf_clear(term);
mpf_clear(tmpA);
mpf_clear(tmpB);
return GSL_SUCCESS;
}*/
/*void ImageTile::PrintState(unsigned iter, gsl_multifit_fdfsolver *solver)
{
std::cout << "f[v,t] := " << gsl_vector_get(solver->x, 0);
for(int i=1;i<=_freqOrder;++i)
std::cout << " + " << gsl_vector_get(solver->x, i) << "*v^" << i;
for(int i=1;i<=_timeOrder;++i)
std::cout << " + " << gsl_vector_get(solver->x, i+_freqOrder) << "*t^" << i;
//std::cout << std::endl << "Iteration " << iter << ": |f(x)|=" << gsl_blas_dnrm2(solver->f) << ", mean = " << _mean << ", variance = " << _variance << ", " << WindowCount() << "/" << (_channelCount*_scanCount);
std::cout << std::endl;
}*/
unsigned ImageTile::WindowCount() const {
unsigned count = 0;
for(unsigned channel=0; channel<_channelCount; ++channel) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment