Skip to content
This repository was archived by the owner on Aug 12, 2024. It is now read-only.

Commit 1a6eeb8

Browse files
author
kruithof
committed
Added documentation,
removed old utilities, added docs/utilities.txt with a description of the utilities Renamed the memory elements to have more sensible names git-svn-id: svn+ssh://jop91.astron.nl/auto/home/jive_cvs/SOFTC/svn/trunk/sfxc@789 5736e3ea-d426-0410-8aaf-93e336ac3372
1 parent 9f85c4d commit 1a6eeb8

33 files changed

+345
-441
lines changed

docs/utilities.txt

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
produce_html_plotpage
2+
---------------------
3+
Usage: produce_html_plotpage [-f] <vex-file> \
4+
<correlation_file> [<output_directory>]
5+
6+
Generates the html-pages used for the ftp-fringe tests.
7+
8+
Options:
9+
-f With this option produce_html_plotpage doesn't after generating the
10+
html-page continues reading in new integration slices and plots those.
11+
12+
13+
produce_html_diffpage
14+
---------------------
15+
Usage: produce_html_diffpage <vex-file> \
16+
<correlation_file1> <correlation_file2> [<output_directory>]
17+
18+
Shows the difference between two correlation output files.
19+
Very similar to produce_html_plotpage
20+
21+
vex2ccf
22+
-------
23+
Generates a skeleton for a ctrl-file from a vex file
24+
Usage: vex2ccf [--full|-f] [--das3] <vex-file> <ctrl-file>
25+
26+
Options:
27+
--full, -f: generate more information, that can be used by the work flow
28+
manager
29+
--das3: addes a das3 specific section
30+
31+
32+
baseline_info
33+
-------------
34+
Prints out information about all integrations of one baseline
35+
Usage: baseline_info <cor-file> <ch_nr> <sideband> <st_nr1> <pol1> <st_nr2> <pol2>
36+
37+
All arguments, except for the cor-file, are the values as found in the
38+
baseline-header
39+
40+
The output is a table with a row for every integration containing:
41+
- The location of the fringe
42+
- The phase of the fringe
43+
- The absolute value of the fringe
44+
- The phase of the center lag
45+
- The absolute value of the center lag
46+
- The signal to noise ratio
47+
- the weight
48+
49+
50+
phase_plot
51+
----------
52+
Usage: phase_plot <cor-file>
53+
Writes out the phase of the fringe for every timeslice
54+
Each row contains the phases for every baseline, in the order that they occur
55+
in the correlation file
56+
57+
plot_delay_table
58+
----------------
59+
converts a binary delay table to an interpolated ascii table
60+
Usage: plot_delay_table <delay-table> <plot-file>
61+
62+
each row contains a value for the time and the delay.
63+
Scans are separated with an extra newline, which makes gnuplot draw a new curve.
64+
65+
mark5a_print_headers
66+
--------------------
67+
Prints the timestamps in the headers of a mark5a file
68+
Usage: mark5a_print_headers <mark5a-file>
69+
70+
print_new_output_format
71+
-----------------------
72+
Usage: print_new_output_format <cor-file>
73+
74+
Prints out all headers in the output correlation file to std::cout and
75+
writes the data to the file "output_new.txt".
76+
77+
78+
generate_uvw_coordinates
79+
------------------------
80+
Usage: generate_uvw_coordinates <delay-file> <start> <stop> <integration-time> <output-file>
81+
82+
Generates a file with ascii uvw coordinates from a delay file
83+
84+
make_anim
85+
---------
86+
Usage: make_anim <ctrl-file> <station1_nr> <station2_nr>
87+
88+
Makes an animated gif displaying the evolution of the fringe of a certain
89+
baseline over time
90+
91+
92+
dnfp_fileclient
93+
---------------
94+
A utility made by Damien to transfer data from a dnfp_server
95+
96+
This file contains a little file client based on a simple protocol.
97+
The application simply connect to a dnfp server and request a file.
98+
99+
dnfp_fileserver
100+
---------------
101+
A utility made by Damien to serve data over a network
102+
103+
This file contains a little file server based on a simple protocol.
104+
The application use a config file named: dnfp_configfile.cfg
105+
106+
this file stores the list of file to expose to the clients...and there
107+
symbolic name in the format:
108+
name1 /path/to/real/file

include/correlation_core.h

+17-14
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111

1212
class Correlation_core : public Tasklet {
1313
public:
14-
typedef Delay_correction::Output_buffer_element Input_buffer_element;
15-
typedef Delay_correction::Output_buffer Input_buffer;
16-
typedef Delay_correction::Output_buffer_ptr Input_buffer_ptr;
14+
typedef Delay_correction::Output_buffer_element Input_buffer_element;
15+
typedef Delay_correction::Output_buffer Input_buffer;
16+
typedef Delay_correction::Output_buffer_ptr Input_buffer_ptr;
1717

18+
typedef Memory_pool_vector_element<FLOAT> Float_buffer;
19+
typedef Memory_pool_vector_element<std::complex<FLOAT> > Complex_buffer;
20+
typedef Memory_pool_vector_element<std::complex<float> > Complex_buffer_float;
1821
Correlation_core();
1922
virtual ~Correlation_core();
2023

@@ -69,22 +72,22 @@ class Correlation_core : public Tasklet {
6972

7073
int number_ffts_in_integration, current_fft, total_ffts;
7174

72-
FFTW_PLAN plan;
73-
Aligned_vector<FLOAT> plan_input_buffer;
74-
Aligned_vector<std::complex<FLOAT> > plan_output_buffer;
75+
FFTW_PLAN plan;
76+
Float_buffer plan_input_buffer;
77+
Complex_buffer plan_output_buffer;
7578

7679
//std::vector< FLOAT > plan_input_buffer;
7780
//std::vector< std::complex<FLOAT> > plan_output_buffer;
7881

7982

80-
Correlation_parameters correlation_parameters;
83+
Correlation_parameters correlation_parameters;
8184

82-
std::vector< Aligned_vector< std::complex<FLOAT> > > frequency_buffer;
83-
std::vector< std::vector<std::complex<FLOAT> > > accumulation_buffers;
84-
std::vector< std::complex<float> > accumulation_buffers_float;
85+
std::vector< Complex_buffer > frequency_buffer;
86+
std::vector< Complex_buffer > accumulation_buffers;
87+
Complex_buffer_float accumulation_buffers_float;
8588
std::vector< std::pair<size_t, size_t> > baselines;
8689

87-
boost::shared_ptr<Data_writer> writer;
90+
boost::shared_ptr<Data_writer> writer;
8891

8992
Timer fft_timer;
9093

@@ -94,9 +97,9 @@ class Correlation_core : public Tasklet {
9497

9598
#ifdef SFXC_WRITE_STATS
9699
// For plotting statistics on the height of the fringe and the phase
97-
std::ofstream stats_out;
98-
Aligned_vector<std::complex<FLOAT> > backward_buffer;
99-
FFTW_PLAN backward_plan_;
100+
std::ofstream stats_out;
101+
Complex_buffer backward_buffer;
102+
FFTW_PLAN backward_plan_;
100103
#endif // SFXC_WRITE_STATS
101104

102105
};

include/correlator_node.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Correlator_node_controller : public Controller {
5252
class Correlator_node : public Node {
5353
public:
5454
typedef Correlator_node Self;
55-
typedef Buffer_element_vector<char> output_value_type;
55+
typedef Memory_pool_vector_element<char> output_value_type;
5656

5757

5858
private:

include/correlator_node_types.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Correlator_node_types {
4848
typedef Threadsafe_queue<Bit_sample_memory_pool_element> Bit_sample_queue;
4949
typedef boost::shared_ptr<Bit_sample_queue> Bit_sample_queue_ptr;
5050

51-
typedef Aligned_vector<FLOAT> Float_element;
51+
typedef Memory_pool_vector_element<FLOAT> Float_element;
5252
typedef Memory_pool<Float_element> Float_memory_pool;
5353
typedef Threadsafe_queue<Float_memory_pool::Element> Float_queue;
5454
typedef boost::shared_ptr<Float_queue> Float_queue_ptr;

include/delay_correction.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class Delay_correction : public Tasklet {
6565

6666
private:
6767
// access functions to the correlation parameters
68-
int number_channels();
68+
size_t number_channels();
6969
int sample_rate();
7070
int bandwidth();
7171
int length_of_one_fft(); // Length of one fft in microseconds
@@ -91,7 +91,7 @@ class Delay_correction : public Tasklet {
9191
Delay_table_akima delay_table;
9292

9393
// You need this one because the input and output are FLOATs (not complex)
94-
Aligned_vector< std::complex<FLOAT> > frequency_buffer;
94+
Memory_pool_vector_element< std::complex<FLOAT> > frequency_buffer;
9595

9696
Timer delay_timer;
9797

include/manager_node.h

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ class Manager_node_controller : public Controller {
3030
};
3131

3232

33+
/**
34+
* The manager node
35+
* \ingroup Node
36+
**/
3337
class Manager_node : public Abstract_manager_node {
3438
public:
3539
enum Status {

include/memory_pool_elements.h

+41-70
Original file line numberDiff line numberDiff line change
@@ -20,87 +20,22 @@
2020

2121
#include "utils.h"
2222

23-
/// Use this element for the buffer class if you want to store an array
24-
/// on every position.
25-
///// DEPRECATED SHOULD BE REMOVED...
26-
template <class T, int N>
27-
class Buffer_element {
28-
public:
29-
typedef T value_type;
30-
inline int size() {
31-
return N;
32-
}
33-
34-
T &operator[](int i) {
35-
assert(i >= 0);
36-
assert(i < N);
37-
return _buffer[i];
38-
}
39-
T *buffer() {
40-
return &_buffer[0];
41-
}
42-
private:
43-
T _buffer[N];
44-
};
45-
46-
/// Use this class if you want to allocate large number of element
47-
/// static array declaration may fails if the array is too large...
48-
template <class T, int N>
49-
class Buffer_element_large {
50-
public:
51-
typedef T value_type;
52-
inline int size() {
53-
return N;
54-
}
55-
56-
Buffer_element_large() {
57-
//std::cout << "Building array of size" << N << std::endl;
58-
_buffer = static_cast<T*>(fftw_malloc(sizeof(T)*N));
59-
}
60-
61-
Buffer_element_large(const Buffer_element_large& src) {
62-
//std::cout << "Building by copy an array of size" << N << std::endl;
63-
_buffer = static_cast<T*>(fftw_malloc(sizeof(T)*N));
64-
memcpy(_buffer, src._buffer, sizeof(T)*N );
65-
}
66-
67-
~Buffer_element_large() {
68-
//std::cout << "Deleting array of size" << N << std::endl;
69-
if (_buffer != NULL) {
70-
fftw_free(_buffer);
71-
}
72-
}
73-
74-
inline T &operator[](int i) {
75-
assert(i >= 0);
76-
assert(i < N);
77-
return (_buffer)[i];
78-
}
79-
80-
inline T *buffer() {
81-
return _buffer;
82-
}
83-
private:
84-
85-
T* _buffer;
86-
};
87-
8823
/// Use this class if you want to allocate large number of element
8924
/// static array declaration may fail if the array is too large...
9025
template <class T>
91-
class Aligned_vector {
26+
class Memory_pool_vector_element {
9227
public:
9328
typedef T value_type;
9429
inline size_t size() const {
9530
return size_;
9631
}
9732

98-
Aligned_vector() {
33+
Memory_pool_vector_element() {
9934
size_ = 0;
10035
buffer_ = NULL;
10136
}
10237

103-
~Aligned_vector() {
38+
~Memory_pool_vector_element() {
10439
// DEBUG_MSG("Deleting array element of size " << size());
10540
if (buffer_ != NULL) {
10641
fftw_free(buffer_);
@@ -151,10 +86,46 @@ class Aligned_vector {
15186
size_t size_;
15287
};
15388

154-
template<class T>
155-
class Buffer_element_vector : public Aligned_vector<T> {
89+
/// Use this class if you want to allocate large number of element
90+
/// static array declaration may fail if the array is too large...
91+
template <class T, int N>
92+
class Memory_pool_fixed_size_element {
15693
public:
15794
typedef T value_type;
95+
inline size_t size() const {
96+
return N;
97+
}
98+
99+
Memory_pool_fixed_size_element() {
100+
// fftw_malloc insure that the allocated data
101+
// is nicely aligned.
102+
buffer_ = static_cast<T*>( fftw_malloc(sizeof(T)*N) );
103+
}
104+
105+
~Memory_pool_fixed_size_element() {
106+
fftw_free(buffer_);
107+
}
108+
109+
inline T& operator[](int i) {
110+
assert(i >= 0);
111+
assert(i < N );
112+
return buffer_[i];
113+
}
114+
115+
inline const T& operator[](int i) const {
116+
assert(i >= 0);
117+
assert(i < N );
118+
return buffer_[i];
119+
}
120+
121+
inline T* buffer() {
122+
return buffer_;
123+
}
124+
private:
125+
126+
// We cannot use a std::vector because we cannot control that
127+
// the data are properly aligned to be used with fftw_xx or SSE
128+
T* buffer_;
158129
};
159130

160131
#endif // BUFFER_H

include/multiple_data_readers_controller.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
class Multiple_data_readers_controller : public Controller {
2525
typedef Multiple_data_readers_controller Self;
2626
public:
27-
typedef Buffer_element_large<char,5000> data_type;
27+
typedef Memory_pool_fixed_size_element<char,5000> data_type;
2828
typedef Data_reader2buffer<data_type> Reader2buffer;
2929
typedef Data_reader_buffer<data_type> Reader_buffer;
3030

include/multiple_data_writers_controller.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
class Multiple_data_writers_controller : public Controller {
2424
typedef Multiple_data_writers_controller Self;
2525
public:
26-
typedef Buffer_element<char,131072> data_type;
27-
typedef Memory_pool<data_type> Memory_pool;
28-
typedef Memory_pool::value_type pool_type;
26+
typedef Memory_pool_vector_element<char> data_type;
27+
typedef Memory_pool<data_type> Memory_pool;
28+
typedef Memory_pool::value_type pool_type;
2929
struct value_type {
3030
int actual_size;
3131
pool_type data;

include/single_data_reader_controller.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,9 @@
2222
class Single_data_reader_controller : public Controller {
2323
typedef Single_data_reader_controller Self;
2424
public:
25-
typedef Buffer_element_large<char,256> data_type;
25+
typedef Memory_pool_fixed_size_element<char,256> data_type;
2626
typedef Data_reader2buffer<data_type> Reader2buffer;
27-
28-
typedef Reader2buffer::Memory_pool Memory_pool;
2927
typedef Reader2buffer::value_type value_type;
30-
typedef Reader2buffer::Queue Queue;
3128
typedef Reader2buffer::Queue_ptr Queue_ptr;
3229

3330
Single_data_reader_controller(Node &node);

0 commit comments

Comments
 (0)