Skip to content

Commit

Permalink
Channelisation & DADA handling fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
David-McKenna committed Oct 8, 2024
1 parent dc037b4 commit 732b74a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
27 changes: 13 additions & 14 deletions src/CLI/lofar_cli_stokes.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "the boxcar window.\n");
window &= (COHERENT_DEDISP & BOXCAR);
}
} else if (!windowCheck) {
} else if (!windowCheck && (channelisation > 1 || (downsampling > 1 && temporalDownsample))) {
fprintf(stderr, "WARNING: No window was set, falling back to the pulsar window.\n");
window |= PSR_STANDARD;
}
Expand All @@ -726,7 +726,7 @@ int main(int argc, char *argv[]) {
return 1;
}

if (numStokes == 0) {
if (numStokes == NOSTOKES) {
printf("No Stokes configuration provided; defaulting to STOKESI\n");
numStokes = 1;
stokesParameters = STOKESI;
Expand All @@ -745,7 +745,17 @@ int main(int argc, char *argv[]) {
channelisation *= downsampling;
}

const int32_t noverlap = 2 * channelisation;
if (channelisation < 1) {
fprintf(stderr, "WARNING: Channelisation was set to %d, returning to 1.\n", channelisation);
channelisation = 1;
} else if ((channelisation > 1 && channelisation % 2) != 0) {
fprintf(stderr, "ERROR: Invalid channelisation factor (less than 1, non-factor of 2)\n");
helpMessages();
CLICleanup(config, outConfig, fftw, NULL);
return 1;
}

const int32_t noverlap = 2 * (channelisation ?: 0);
const int32_t nbin = nfactor * channelisation;
const int32_t nbin_valid = nbin - 2 * noverlap;

Expand All @@ -756,10 +766,6 @@ int main(int argc, char *argv[]) {
}
config->packetsPerIteration = (nbin_valid * nforward) / UDPNTIMESLICE;


if (channelisation < 2) {
channelisation = 1;
}
if (channelisation > 1 || window & COHERENT_DEDISP) {
// Should no longer be needed; keeping for debug/validation purposes; remove before release
int32_t invalidation = (config->packetsPerIteration * UDPNTIMESLICE) % nbin_valid;
Expand All @@ -777,13 +783,6 @@ int main(int argc, char *argv[]) {
}
}

if (channelisation < 1 || (channelisation > 1 && channelisation % 2) != 0) {
fprintf(stderr, "ERROR: Invalid channelisation factor (less than 1, non-factor of 2)\n");
helpMessages();
CLICleanup(config, outConfig, fftw, NULL);
return 1;
}

if (downsampling < 1) {
fprintf(stderr, "ERROR: Invalid downsampling factor (less than 1)\n");
helpMessages();
Expand Down
19 changes: 13 additions & 6 deletions src/lib/lofar_udp_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -961,12 +961,19 @@ int32_t _lofar_udp_reader_config_check(const lofar_udp_config *config) {
}

for (int8_t port = 0; port < config->numPorts; port++) {
if (!strlen(config->inputLocations[port])) {
fprintf(stderr, "ERROR: You requested %d ports, but port %d is an empty string, exiting.\n", config->numPorts, port);
return -1;
} else if (access(config->inputLocations[port], F_OK) != 0) {
fprintf(stderr, "ERROR: Failed to open file at %s (port %d), exiting.\n", config->inputLocations[port], port);
return -1;
if (!(config->readerType & DADA_ACTIVE)) {
if (!strlen(config->inputLocations[port])) {
fprintf(stderr, "ERROR: You requested %d ports, but port %d is an empty string, exiting.\n", config->numPorts, port);
return -1;
} else if (access(config->inputLocations[port], F_OK) != 0) {
fprintf(stderr, "ERROR: Failed to open file at %s (port %d), exiting.\n", config->inputLocations[port], port);
return -1;
}
} else {
if (config->inputDadaKeys[port] < 0) {
fprintf(stderr, "ERROR: You requested %d ports, but the DADA key for port %d is unset, exiting.\n", config->numPorts, config->inputDadaKeys[port]);
return -1;
}
}
}

Expand Down

0 comments on commit 732b74a

Please sign in to comment.