28 #ifndef SYNTHESIS_IMAGER_MIXIN_H_
29 #define SYNTHESIS_IMAGER_MIXIN_H_
35 #include <sys/types.h>
45 #include <system_error>
57 std::unique_ptr<SynthesisImager>
si;
63 static bool haveCFCache(
const std::string &dirname);
65 static int isCFS(
const struct dirent *d);
72 const std::vector<SynthesisParamsImage> &image_pars) {
87 ? weight_pars.
asInt(
"npixels")
91 ? weight_pars.
asBool(
"multifield")
95 ? weight_pars.
asBool(
"usecubebriggs")
128 si->weight(type, rmode, noise, robust, field_of_view, npixels,
129 multifield, usecubebriggs, filter_type, bmaj, bmin, bpa);
130 if (image_pars.size() == 1
133 si->getWeightDensity();
134 T::reduce_weight_density();
135 si->setWeightDensity();
142 std::vector<SynthesisParamsSelect> &select_pars,
143 std::vector<SynthesisParamsImage> &image_pars,
144 std::vector<SynthesisParamsGrid> &grid_pars,
149 int imaging_rank = T::effective_rank(comm);
150 if (imaging_rank == 0) {
152 for (
auto s : select_pars)
155 i <
std::min(image_pars.size(), grid_pars.size());
157 si->defineImage(image_pars[i], grid_pars[i]);
159 int imaging_size = T::effective_size(comm);
160 if (imaging_rank >= 0 && imaging_size > 1) {
163 if (imaging_rank == 0) {
164 std::vector<std::string>
empty;
165 si->dryGridding(empty);
167 std::vector<std::string> cf_list =
169 if (cf_list.size() > 0) {
171 si = std::unique_ptr<SynthesisImager>(
180 si->selectData(select_pars.at(imaging_rank));
181 si->defineImage(image_pars.at(imaging_rank),
182 grid_pars.at(imaging_rank));
184 if (imaging_rank >= 0)
196 if (
si !=
nullptr)
si->makePSF();
202 rec.
define(
"lastcycle", T::is_clean_complete());
204 if (
si !=
nullptr)
si->executeMajorCycle(rec);
205 T::end_major_cycle();
211 if (
si !=
nullptr)
si->predictModel();
224 case casacore::DataType::TpRecord:
227 case casacore::DataType::TpString:
235 oss <<
"Error in converting quantity: " << err_str;
250 oss <<
"Error in converting quantity: " << err_str;
259 struct stat stat_buf;
260 return (stat(dirname.c_str(), &stat_buf) == 0
261 && S_ISDIR(stat_buf.st_mode));
267 std::string
name(d->d_name);
268 return name.find(
"CFS") == 0;
272 std::vector<std::string>
276 std::vector<std::string> result;
277 struct dirent **namelist;
278 int nCFS = scandir(grid_pars.
cfCache.
c_str(), &namelist,
285 for (
int n = rank; n < nCFS; n +=
size) {
286 std::string
name(namelist[n]->d_name);
287 result.push_back(name);
292 std::error_condition ec(errno, std::generic_category());
302 #endif // SYNTHESIS_IMAGER_MIXIN_H_
const Record & subRecord(const RecordFieldId &) const
Get the subrecord from the given field.
Bool asBool(const RecordFieldId &) const
The following functions get the value based on field name or number.
A Vector of integers, for indexing into Array<T> objects.
virtual Bool fromRecord(String &error, const RecordInterface &in)
Create a Quantum from a record or a string.
const Array< String > & asArrayString(const RecordFieldId &) const
size_t nelements() const
How many elements does this array have? Product of all axis lengths.
void setup_imager(MPI_Comm comm, std::vector< SynthesisParamsSelect > &select_pars, std::vector< SynthesisParamsImage > &image_pars, std::vector< SynthesisParamsGrid > &grid_pars, casacore::Record &weight_pars)
Quantum< Double > Quantity
virtual Type type()
Return the type enum.
casacore::String ftmachine
std::unique_ptr< SynthesisImager > si
Class that contains functions needed for imager.
A holder for Quantums to enable record conversions.
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
casacore::Bool aTermOn
For wb-aprojection ftm.
Simple mixin class to put SynthesisImager into ParallelImagerMixin framework.
DataType dataType(const RecordFieldId &) const
virtual Int fieldNumber(const String &fieldName) const
Get the field number from the field name.
void execute_major_cycle()
static bool haveCFCache(const std::string &dirname)
const Char * c_str() const
Get char array.
const Quantum< Double > & asQuantity()
Double asDouble(const RecordFieldId &) const
A hierarchical collection of named fields of various types.
bool Bool
Define the standard types used by Casacore.
static int isCFS(const struct dirent *d)
static casacore::Quantity asQuantity(const casacore::Record &rec, const char *field_name)
TODO: this method is a utility function...move it into another module?
casacore::Bool empty() const
void set_weighting(const casacore::Record &weight_pars, const std::vector< SynthesisParamsImage > &image_pars)
virtual Bool fromString(String &error, const String &in)
Initialise the class from a String representation.
Int asInt(const RecordFieldId &) const
Base class for all Casacore library errors.
const String & asString(const RecordFieldId &) const
String: the storage and methods of handling collections of characters.
void define(const RecordFieldId &, Bool value)
Define a value for the given field.
static std::vector< std::string > getCFCacheList(const SynthesisParamsGrid &grid_pars, int size, int rank)