27 #ifndef CUBE_PARTITION_MIXIN_H_
28 #define CUBE_PARTITION_MIXIN_H_
53 const std::string image_types[] =
54 {
"image",
"psf",
"model",
"residual",
"mask",
"pb",
"weight"};
55 string cwd(getcwd(
nullptr, 0));
63 std::string imagename =
65 std::string image_prefix = cwd +
"/" + imagename;
66 std::vector<std::string> images;
67 for (
auto ext : image_types) {
69 std::string ext_suffix =
"." + ext;
70 std::string concat_imagename =
71 image_prefix + ext_suffix;
73 std::string component_imagename =
75 if (access(component_imagename.c_str(), F_OK) == 0)
76 images.push_back(component_imagename);
78 if (!images.empty()) {
79 std::string cmd =
"imageconcat inimages='";
80 for (
auto im : images) cmd += im +
" ";
81 cmd +=
"' outimage='" + concat_imagename +
"' type=";
83 int rc = std::system(cmd.c_str());
84 if (rc == -1 || WEXITSTATUS(rc) != 0)
86 << (
"concatenation of " + concat_imagename
118 std::string cwd(getcwd(
nullptr, 0));
119 std::vector<std::string> all_worker_suffixes;
123 std::string my_worker_suffix =
132 if (worker_rank >= 0) {
139 si->selectData(selection_pars);
148 si->defineImage(image_pars, grid_pars);
151 int nchan = ((image_pars.
nchan == -1)
153 : image_pars.
nchan);;
164 num_workers, nchan, csystems, numchans).
165 rwSubRecord(worker_rank_str));
172 if (worker_rank >= 0) {
178 if (name.
find(
"ms") == 0) {
192 if (worker_rank >= 0) {
211 if (worker_rank >= 0) {
212 auto modify_cfcache = [&](
const char *field_val) {
213 return *field_val + my_worker_suffix;
243 std::function<std::string(
const char *)> fn) {
245 msRec.
define(field, fn(msRec.asString(field).c_str()));
269 #endif // CUBE_PARTITION_MIXIN_H_
const Record & subRecord(const RecordFieldId &) const
Get the subrecord from the given field.
Record & rwSubRecord(const RecordFieldId &)
void fromRecord(const casacore::Record &inrec)
void concat_images(const string &type)
LatticeExprNode log(const LatticeExprNode &expr)
void defineRecord(const RecordFieldId &, const Record &value, RecordType type=Variable)
Define a value for the given field containing a subrecord.
static CoordinateSystem * restore(const RecordInterface &container, const String &fieldName)
Restore the CoordinateSystem from a record.
casacore::Int nchan
Spectral coordinates (TT : Add other params here)
casacore::Record deconvolution
virtual Type type()
Return the type enum.
casacore::Record selection
casacore::Record normalization
Class that contains functions needed for imager.
ostream-like interface to creating log messages.
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
Change the message priority to WARN.
#define MPI_Comm_size(c, sp)
Collection of parameters for parallel imaging, categorized roughly by imaging component.
virtual uInt nfields() const
How many fields does this structure have? A convenient synonym for description().nfields().
static ParamFieldIterator end(casacore::Record *rec, const string &prefix="")
static ParamFieldIterator begin(casacore::Record *rec, const string &prefix="")
#define MPI_Comm_rank(c, rp)
void clear()
Clear the string Warning: clear() executed as erase() due to missing clear() in gcc ...
casacore::Record image_parameters
A hierarchical collection of named fields of various types.
void fromRecord(const casacore::Record &inrec)
Bool isDefined(const String &fieldName) const
Test if a field name exists.
void fromRecord(const casacore::Record &inrec)
casacore::Record empty_fields(casacore::Record &rec, const char *field)
Convenience method to clear certain record fields.
std::string to_string(int i)
Post the accumulated message.
LogOrigin: The source code location of the originator of a LogMessage.
size_type find(const string &str, size_type pos=0) const
Search functions.
const String & asString(const RecordFieldId &) const
casacore::Record iteration
String: the storage and methods of handling collections of characters.
static casacore::Record cubeDataImagePartition(const casacore::Record &selpars, const casacore::CoordinateSystem &incsys, const casacore::Int npart, const casacore::Int nchannel, casacore::Vector< casacore::CoordinateSystem > &outCsys, casacore::Vector< casacore::Int > &outnChan)
casacore::CoordinateSystem and number of channels of original cube is passed in Output record is the ...
ParallelImagerParams get_params(MPI_Comm wcomm, ParallelImagerParams &initial)
casacore::Record convert_fields(casacore::Record &rec, const char *field, std::function< std::string(const char *)> fn)
Convenience method to transform certain record fields.
void define(const RecordFieldId &, Bool value)
Define a value for the given field.
Parameter and input data partitioning for parallel cube imaging (in ParallelImagerMixin).
String name(const RecordFieldId &) const
Get the name of this field.