From ee946c7f31a60397d10f2bbce53fee28a8fae720 Mon Sep 17 00:00:00 2001 From: Miguel Carcamo Date: Wed, 2 Nov 2022 10:46:05 +0000 Subject: [PATCH 1/5] FIX: fixing environments --- environment.yml | 1 + environment_cudatoolkit.yml | 1 + tests/FREQ78/test.sh | 12 ++++++------ tests/M87/test.sh | 12 ++++++------ tests/antennae/test.sh | 12 ++++++------ tests/co65/test.sh | 12 ++++++------ tests/selfcalband9/test.sh | 12 ++++++------ 7 files changed, 32 insertions(+), 30 deletions(-) diff --git a/environment.yml b/environment.yml index 86c89b71..e14781a4 100644 --- a/environment.yml +++ b/environment.yml @@ -7,6 +7,7 @@ dependencies: - casacore - cfitsio - openmpi +- mpi4py - python=3.8 - numpy=1.23 - pip diff --git a/environment_cudatoolkit.yml b/environment_cudatoolkit.yml index b09dde0e..f4f915a8 100644 --- a/environment_cudatoolkit.yml +++ b/environment_cudatoolkit.yml @@ -10,6 +10,7 @@ dependencies: - cuda-toolkit - cuda-samples - openmpi +- mpi4py - python=3.8 - numpy=1.23 - pip diff --git a/tests/FREQ78/test.sh b/tests/FREQ78/test.sh index 766fe559..446f3505 100644 --- a/tests/FREQ78/test.sh +++ b/tests/FREQ78/test.sh @@ -1,10 +1,10 @@ function valid () { - if [ $? -eq 0 ]; then - echo OK - else - echo ERROR - exit 1 - fi + if [ $? -eq 0 ]; then + echo OK + else + echo ERROR + exit 1 + fi } test=$($1 -i $2/FREQ78.ms -o $2/residuals.ms -O $2/mod_out.fits -m $2/mod_in_0.fits -p $2/mem/ -X 16 -Y 16 -V 256 -z 0.001 -Z 0.005,0.0 -t 500000000 -g 2 --verbose --print-images) diff --git a/tests/M87/test.sh b/tests/M87/test.sh index 43a5fc83..d7c6bec4 100644 --- a/tests/M87/test.sh +++ b/tests/M87/test.sh @@ -1,10 +1,10 @@ function valid () { - if [ $? -eq 0 ]; then - echo OK - else - echo ERROR - exit 1 - fi + if [ $? -eq 0 ]; then + echo OK + else + echo ERROR + exit 1 + fi } test=$($1 -i $2/SR1_M87_2017_101_hi_hops_netcal_StokesI.selfcal.LLRR.ms -o $2/residuals.ms -O $2/mod_out.fits -m $2/mod_in_0.fits -p $2/mem/ -X 16 -Y 16 -V 256 --verbose --print-images -z 0.0,0.0 -Z 0.0,0.001,0.005 -R -2.0 -t 500000000 --use-radius-mask) diff --git a/tests/antennae/test.sh b/tests/antennae/test.sh index 1c5676fe..3498b7bb 100644 --- a/tests/antennae/test.sh +++ b/tests/antennae/test.sh @@ -1,10 +1,10 @@ function valid () { - if [ $? -eq 0 ]; then - echo OK - else - echo ERROR - exit 1 - fi + if [ $? -eq 0 ]; then + echo OK + else + echo ERROR + exit 1 + fi } test=$($1 -i $2/all_fields.ms -o $2/residuals.ms -O $2/mod_out.fits -m $2/mod_in_0.fits -p $2/mem/ -X 16 -Y 16 -V 256 -z 0.001 -Z 0.01,0.0 -g 1 -R 2.0 -t 500000000 --print-images --verbose) diff --git a/tests/co65/test.sh b/tests/co65/test.sh index 685c413e..148c4490 100644 --- a/tests/co65/test.sh +++ b/tests/co65/test.sh @@ -1,10 +1,10 @@ function valid () { - if [ $? -eq 0 ]; then - echo OK - else - echo ERROR - exit 1 - fi + if [ $? -eq 0 ]; then + echo OK + else + echo ERROR + exit 1 + fi } test=$($1 -X 16 -Y 16 -V 256 -i $2/co65.ms -o $2/residuals.ms -O $2/mod_out.fits -m $2/mod_in_0.fits -p $2/mem/ -z 0.001 -Z 0.01,0.05 -g 1 -t 500000000 --verbose) diff --git a/tests/selfcalband9/test.sh b/tests/selfcalband9/test.sh index 9d0a5afa..05efd226 100644 --- a/tests/selfcalband9/test.sh +++ b/tests/selfcalband9/test.sh @@ -1,10 +1,10 @@ function valid () { - if [ $? -eq 0 ]; then - echo OK - else - echo ERROR - exit 1 - fi + if [ $? -eq 0 ]; then + echo OK + else + echo ERROR + exit 1 + fi } test=$($1 -i $2/hd142_b9cont_self_tav.ms -o $2/residuals.ms -O $2/mod_out.fits -m $2/mod_in_0.fits -p $2/mem/ -X 16 -Y 16 -V 256 --verbose -z 0.001,3.5 -Z 0.05,0.0 -t 500000000 -g 1 --print-images --print-errors) From 19c0b2596fa70c671fd8a3ec96882cb4bddbba87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20C=C3=A1rcamo?= Date: Thu, 3 Nov 2022 18:50:03 +0000 Subject: [PATCH 2/5] CHG: adding meas.j2000 when reading fields so all of them are on a common frame --- src/MSFITSIO.cu | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/MSFITSIO.cu b/src/MSFITSIO.cu index e2d79624..0748f687 100644 --- a/src/MSFITSIO.cu +++ b/src/MSFITSIO.cu @@ -399,9 +399,10 @@ __host__ void readMS(const char* MS_name, data->telescope_name = obs_col(0); - std::string field_query = - "select REFERENCE_DIR,PHASE_DIR,ROWID() AS ID FROM " + dir + - "/FIELD where !FLAG_ROW"; + std::string field_query = "select meas.j2000(REFERENCE_DIR) as " + + "REFERENCE_DIR,meas.j2000(PHASE_DIR) " + + "as PHASE_DIR,ROWID() AS ID FROM " + dir + + "/FIELD where !FLAG_ROW"; casacore::Table field_tab(casacore::tableCommand(field_query.c_str())); std::string aux_query = "select DATA_DESC_ID FROM " + dir + From 2f98b221eba902fff08d1faa596e51d56cc30fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20C=C3=A1rcamo?= Date: Thu, 3 Nov 2022 18:58:02 +0000 Subject: [PATCH 3/5] CHG: adding meas.j2000 when reading fields so all of them are on a common frame --- src/MSFITSIO.cu | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MSFITSIO.cu b/src/MSFITSIO.cu index 0748f687..6bd2a0ed 100644 --- a/src/MSFITSIO.cu +++ b/src/MSFITSIO.cu @@ -399,10 +399,10 @@ __host__ void readMS(const char* MS_name, data->telescope_name = obs_col(0); - std::string field_query = "select meas.j2000(REFERENCE_DIR) as " + - "REFERENCE_DIR,meas.j2000(PHASE_DIR) " + - "as PHASE_DIR,ROWID() AS ID FROM " + dir + - "/FIELD where !FLAG_ROW"; + std::string field_query = + "select meas.j2000(REFERENCE_DIR) as REFERENCE_DIR,meas.j2000(PHASE_DIR) " + "as PHASE_DIR,ROWID() AS ID FROM " + + dir + "/FIELD where !FLAG_ROW"; casacore::Table field_tab(casacore::tableCommand(field_query.c_str())); std::string aux_query = "select DATA_DESC_ID FROM " + dir + From 97d0e3d50191b917faef88db0bb5dc5ea3ae9915 Mon Sep 17 00:00:00 2001 From: Miguel Carcamo Date: Mon, 7 Nov 2022 20:54:09 +0000 Subject: [PATCH 4/5] CHG: Fix reference frequency calculation --- src/mfs.cu | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mfs.cu b/src/mfs.cu index 96a0f57a..9c4f34e8 100644 --- a/src/mfs.cu +++ b/src/mfs.cu @@ -261,6 +261,7 @@ void MFS::configure(int argc, char** argv) { std::vector ms_ref_freqs; std::vector ms_max_freqs; + std::vector ms_min_freqs; std::vector ms_max_blength; std::vector ms_min_blength; std::vector ms_uvmax_wavelength; @@ -269,6 +270,7 @@ void MFS::configure(int argc, char** argv) { datasets[d].fields, &datasets[d].data); ms_ref_freqs.push_back(datasets[d].data.ref_freq); ms_max_freqs.push_back(datasets[d].data.max_freq); + ms_min_freqs.push_back(datasets[d].data.min_freq); ms_max_blength.push_back(datasets[d].data.max_blength); ms_min_blength.push_back(datasets[d].data.min_blength); ms_uvmax_wavelength.push_back(datasets[d].data.uvmax_wavelength); @@ -280,6 +282,7 @@ void MFS::configure(int argc, char** argv) { Calculating theoretical resolution */ float max_freq = *max_element(ms_max_freqs.begin(), ms_max_freqs.end()); + float min_freq = *min_element(ms_min_freqs.begin(), ms_min_freqs.end()); float max_blength = *max_element(ms_max_blength.begin(), ms_max_blength.end()); float min_wlength = freq_to_wavelength(max_freq); @@ -299,9 +302,10 @@ void MFS::configure(int argc, char** argv) { if (nu_0 < 0.0) { printf( - "Reference frequency not provided. It will be calculated as the median " + "WARNING: Reference frequency not provided. It will be calculated as " + "the median " "of all the arrays of frequencies.\n"); - nu_0 = median(ms_ref_freqs); + nu_0 = 0.5f * (max_freq + min_freq); } printf("Reference frequency: %e Hz\n", nu_0); double deltau_theo = 2.0 * max_uvmax_wavelength / (M - 1); From ef1466056dbab183cbaa2ae82bb606c32cdf2991 Mon Sep 17 00:00:00 2001 From: Miguel Carcamo Date: Mon, 7 Nov 2022 20:58:33 +0000 Subject: [PATCH 5/5] CHG: Fix reference frequency calculation --- src/mfs.cu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mfs.cu b/src/mfs.cu index 9c4f34e8..3be2a34b 100644 --- a/src/mfs.cu +++ b/src/mfs.cu @@ -303,8 +303,8 @@ void MFS::configure(int argc, char** argv) { if (nu_0 < 0.0) { printf( "WARNING: Reference frequency not provided. It will be calculated as " - "the median " - "of all the arrays of frequencies.\n"); + "the middle" + "of the frequency range.\n"); nu_0 = 0.5f * (max_freq + min_freq); } printf("Reference frequency: %e Hz\n", nu_0);