[2155] | 1 | #include "machdefs.h"
|
---|
| 2 | #include <stdio.h>
|
---|
| 3 | #include <stdlib.h>
|
---|
| 4 | #include <iostream.h>
|
---|
| 5 | #include <math.h>
|
---|
| 6 |
|
---|
| 7 | #include <typeinfo>
|
---|
| 8 | #include <vector>
|
---|
| 9 | #include <string>
|
---|
| 10 |
|
---|
| 11 | #include "piacmd.h"
|
---|
| 12 | #include "nobjmgr.h"
|
---|
| 13 | #include "pistdimgapp.h"
|
---|
| 14 | #include "servnobjm.h"
|
---|
| 15 | #include "tvector.h"
|
---|
| 16 | #include "pidrawer.h"
|
---|
| 17 | #include "nomgadapter.h"
|
---|
| 18 |
|
---|
| 19 | #include "skymap.h"
|
---|
| 20 | #include "sphericaltransformserver.h"
|
---|
| 21 |
|
---|
| 22 | extern "C" {
|
---|
| 23 | void skymapmodule_init();
|
---|
| 24 | void skymapmodule_end();
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | class skymapmoduleExecutor : public CmdExecutor {
|
---|
| 28 | public:
|
---|
[2175] | 29 | enum {UnKnown=(uint_2) 0,
|
---|
| 30 | TypeR8=(uint_2) 16, TypeR4=(uint_2) 32,
|
---|
| 31 | Spherical=(uint_2) 1, HealPix=(uint_2) 2, ThetaPhi=(uint_2) 4,
|
---|
| 32 | Spherical8=(uint_2) Spherical|TypeR8,
|
---|
| 33 | Spherical4=(uint_2) Spherical|TypeR4,
|
---|
| 34 | HealPix8 =(uint_2) Spherical|HealPix|TypeR8,
|
---|
| 35 | HealPix4 =(uint_2) Spherical|HealPix|TypeR4,
|
---|
| 36 | ThetaPhi8 =(uint_2) Spherical|ThetaPhi|TypeR8,
|
---|
| 37 | ThetaPhi4 =(uint_2) Spherical|ThetaPhi|TypeR4};
|
---|
| 38 |
|
---|
[2155] | 39 | skymapmoduleExecutor();
|
---|
| 40 | virtual ~skymapmoduleExecutor();
|
---|
| 41 | virtual int Execute(string& keyw, vector<string>& args, string& toks);
|
---|
[2175] | 42 |
|
---|
| 43 | void TypeMap(vector<string>& tokens);
|
---|
[2155] | 44 | void Map2Double(vector<string>& tokens);
|
---|
[2175] | 45 | void Map2Map(vector<string>& tokens);
|
---|
[2155] | 46 | void MapMult(vector<string>& tokens);
|
---|
[2156] | 47 | void MapCover(vector<string>& tokens);
|
---|
[2155] | 48 | void Map2Cl(vector<string>& tokens);
|
---|
[2162] | 49 | void Cl2Map(vector<string>& tokens);
|
---|
[2156] | 50 | void Map2Alm(vector<string>& tokens);
|
---|
[2162] | 51 | void Alm2Map(vector<string>& tokens);
|
---|
[2155] | 52 | void CrMapMask(vector<string>& tokens);
|
---|
| 53 | void CrMaskFrMap(vector<string>& tokens);
|
---|
| 54 | void MaskMap(vector<string>& tokens);
|
---|
| 55 | void MapProj(vector<string>& tokens);
|
---|
[2162] | 56 | void Map2Local(vector<string>& tokens);
|
---|
[2155] | 57 | void MapOper(vector<string>& tokens);
|
---|
[2162] | 58 | void MapStat(vector<string>& tokens);
|
---|
[2175] | 59 | protected:
|
---|
| 60 | void SetTypeMap(vector<string>& tokens);
|
---|
| 61 | bool IsNSideGood(int_4 nside);
|
---|
| 62 | void GetNSideGood(int_4 &nside);
|
---|
| 63 | uint_2 typemap(AnyDataObj* obj);
|
---|
| 64 |
|
---|
| 65 | uint_2 DefTypMap;
|
---|
[2155] | 66 | };
|
---|
| 67 |
|
---|
| 68 | /* --Methode-- */
|
---|
| 69 | skymapmoduleExecutor::skymapmoduleExecutor()
|
---|
| 70 | {
|
---|
| 71 | PIACmd * mpiac;
|
---|
| 72 | NamedObjMgr omg;
|
---|
| 73 | mpiac = omg.GetImgApp()->CmdInterpreter();
|
---|
| 74 |
|
---|
| 75 | string hgrp = "SkyMapCmd";
|
---|
[2175] | 76 | string kw,usage;
|
---|
[2155] | 77 |
|
---|
[2175] | 78 | kw = "settypemap";
|
---|
| 79 | usage = "Set le type de map par default";
|
---|
| 80 | usage += "\n type= H for Healpix (default)";
|
---|
| 81 | usage += "\n T for ThetaPhi";
|
---|
| 82 | usage += "\n Usage: settypemap type";
|
---|
| 83 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 84 |
|
---|
| 85 | kw = "typemap";
|
---|
| 86 | usage = "Imprime le type de map";
|
---|
| 87 | usage += "\n Usage: typemap map";
|
---|
| 88 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 89 |
|
---|
| 90 | kw = "map2double";
|
---|
| 91 | usage = "Convert a float map to a double map";
|
---|
[2155] | 92 | usage += "\n Usage: map2double map";
|
---|
| 93 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 94 |
|
---|
[2175] | 95 | kw = "map2map";
|
---|
| 96 | usage = "Convert a map into an other map type";
|
---|
| 97 | usage += "\n type= H for Healpix";
|
---|
| 98 | usage += "\n T for ThetaPhi";
|
---|
| 99 | usage += "\n if nside <=1 use nside from map";
|
---|
| 100 | usage += "\n Usage: map2map map type [nside]";
|
---|
| 101 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 102 |
|
---|
[2155] | 103 | kw = "mapmult";
|
---|
| 104 | usage = "Multiply a map by a constant";
|
---|
| 105 | usage += "\n Usage: mapmult map cste";
|
---|
| 106 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 107 |
|
---|
[2156] | 108 | kw = "mapcover";
|
---|
| 109 | usage = "Print the covering of a map";
|
---|
[2162] | 110 | usage += "\n Usage: mapcover map v1,v2 [varname]";
|
---|
| 111 | usage += "\n v1,v2: good pixels have v1<=val<=v2 (def=0.99,1.01)";
|
---|
| 112 | usage += "\n (use default (0.99,1.01): \"!\")";
|
---|
[2156] | 113 | usage += "\n $varname: percent of sky covering";
|
---|
| 114 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 115 |
|
---|
[2155] | 116 | kw = "map2cl";
|
---|
| 117 | usage = "SkyMap to Cl";
|
---|
| 118 | usage += "\n Usage: map2cl map(double) clvec [lmax] [niter]";
|
---|
[2162] | 119 | usage += "\n lmax: if <=0 or \"!\" use default (3*nside-1)";
|
---|
| 120 | usage += "\n niter: number of iterations (<=0 or def=3)";
|
---|
[2155] | 121 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 122 |
|
---|
[2162] | 123 | kw = "cl2map";
|
---|
| 124 | usage = "Generate SkyMap from Cl";
|
---|
| 125 | usage += "\n Usage: cl2map clvec map nside [fwhm]";
|
---|
[2175] | 126 | usage += "\n (see command settypemap)";
|
---|
[2162] | 127 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 128 |
|
---|
[2156] | 129 | kw = "map2alm";
|
---|
| 130 | usage = "SkyMap to Alm";
|
---|
| 131 | usage += "\n Usage: map2alm map(double) almmat [lmax] [niter]";
|
---|
[2162] | 132 | usage += "\n lmax: if <=0 or \"!\" use default (3*nside-1)";
|
---|
| 133 | usage += "\n niter: number of iterations (<=0 or def=3)";
|
---|
[2156] | 134 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 135 |
|
---|
[2162] | 136 | kw = "alm2map";
|
---|
| 137 | usage = "Generate SkyMap from Alm";
|
---|
| 138 | usage += "\n Usage: alm2map almmat map nside";
|
---|
[2175] | 139 | usage += "\n (see command settypemap)";
|
---|
[2162] | 140 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 141 |
|
---|
[2155] | 142 | kw = "crmapmask";
|
---|
[2162] | 143 | usage = "Create a map mask (nside) between latitudes lat1,lat2 longitudes lon1,lon2";
|
---|
| 144 | usage += "\n Usage: crmapmask mapmsk nside lat1,lat2 lon1,lon2 [valmsk,valnomsk]";
|
---|
[2155] | 145 | usage += "\n mask pixels between [lat1,lat2] ([-90,90] in degrees)";
|
---|
[2162] | 146 | usage += "\n and [lon1,lon2] ([0,360[ in degrees)";
|
---|
| 147 | usage += "\n (for no mask \"!\")";
|
---|
| 148 | usage += "\n valmsk=value to be written into masked pixels (def=0)";
|
---|
| 149 | usage += "\n valnomsk=value to be written into unmasked pixels (def=1)";
|
---|
[2175] | 150 | usage += "\n (see command settypemap)";
|
---|
[2155] | 151 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 152 |
|
---|
| 153 | kw = "crmaskfrmap";
|
---|
| 154 | usage = "Create a map mask (nside) relative to an other map pixels values";
|
---|
[2162] | 155 | usage += "\n Usage: crmaskfrmap mapmsk nside map(double) v1,v2 [valmsk,valnomsk]";
|
---|
[2155] | 156 | usage += "\n mask if v1<mapmsk(i)<v2";
|
---|
[2162] | 157 | usage += "\n valmsk=value to be written into masked pixels (def=0)";
|
---|
| 158 | usage += "\n valnomsk=value to be written into unmasked pixels (def=1)";
|
---|
[2155] | 159 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 160 |
|
---|
| 161 | kw = "maskmap";
|
---|
| 162 | usage = "Mask a map with a mask map";
|
---|
| 163 | usage += "\n Usage: maskmap map msk";
|
---|
| 164 | usage += "\n operation is map(i) *= msk(theta,phi)";
|
---|
| 165 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 166 |
|
---|
| 167 | kw = "maproj";
|
---|
| 168 | usage = "Project a map into an other one";
|
---|
| 169 | usage += "\n Usage: maproj map mapproj [nside]";
|
---|
| 170 | usage += "\n Create mapproj(nside) and project map into mapproj";
|
---|
| 171 | usage += "\n (use \"maproj map mapproj\" to make a copy)";
|
---|
| 172 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 173 |
|
---|
[2162] | 174 | kw = "map2local";
|
---|
| 175 | usage = "Project a map into a local map";
|
---|
| 176 | usage += "\n Usage: map2local map localmap nx,ny angleX,angleY phi0,theta0 [x0,y0] [angle]";
|
---|
| 177 | usage += "\n nx,ny: number of pixels in x(col),y(row) direction";
|
---|
| 178 | usage += "\n X-axis==phi, Y-axis==theta";
|
---|
| 179 | usage += "\n angleX,angleY: total angle aperture in x,y direction (degrees)";
|
---|
| 180 | usage += "\n phi0,theta0: define origin in phi,theta (degrees)";
|
---|
| 181 | usage += "\n x0,y0: map phi0,theta0 to pixel x0,y0 (\"!\" or def=middle of the localmap)";
|
---|
| 182 | usage += "\n angle: angle (degrees) of rotation between x-axis of map-coordinate system";
|
---|
| 183 | usage += "\n and the tangent to parallel on the sphere (def: 0.)";
|
---|
| 184 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 185 |
|
---|
[2155] | 186 | kw = "mapop";
|
---|
| 187 | usage = "operation on a map";
|
---|
| 188 | usage += "\n Usage: mapop map op1 map1 [op2 map2] [op2 map3] [...]";
|
---|
| 189 | usage += "\n Do \"map op1= map1\", \"map op2=map2\", ...";
|
---|
| 190 | usage += "\n where op = +,-,*,/";
|
---|
| 191 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 192 |
|
---|
[2162] | 193 | kw = "mapstat";
|
---|
| 194 | usage = "Statistics from a map";
|
---|
| 195 | usage += "\n Usage: mapstat map [msk] [meanvarname] [sigmavarname]";
|
---|
| 196 | usage += "\n msk = mask sphere used as weight";
|
---|
| 197 | usage += "\n if msk(i)<=0 do not use that pixel";
|
---|
| 198 | usage += "\n if msk(i)>0 use that pixel with weight msk(i)";
|
---|
| 199 | usage += "\n msk = \"!\" means no mask sphere";
|
---|
| 200 | usage += "\n meanvarname = variable name to store mean";
|
---|
| 201 | usage += "\n sigmavarname = variable name to store sigma";
|
---|
| 202 | usage += "\n (\"!\" means do not store)";
|
---|
| 203 | mpiac->RegisterCommand(kw, usage, this, hgrp);
|
---|
| 204 |
|
---|
[2175] | 205 | DefTypMap = HealPix;
|
---|
[2155] | 206 | }
|
---|
| 207 |
|
---|
| 208 | /* --Methode-- */
|
---|
| 209 | skymapmoduleExecutor::~skymapmoduleExecutor()
|
---|
| 210 | {
|
---|
| 211 | }
|
---|
| 212 |
|
---|
| 213 | /* --Methode-- */
|
---|
| 214 | int skymapmoduleExecutor::Execute(string& kw, vector<string>& tokens, string& toks)
|
---|
| 215 | {
|
---|
| 216 |
|
---|
[2175] | 217 | if(kw == "settypemap") {
|
---|
| 218 | SetTypeMap(tokens);
|
---|
| 219 | } else if(kw == "typemap") {
|
---|
[2155] | 220 | if(tokens.size()<1) {
|
---|
[2175] | 221 | cout<<"Usage: typemap map"<<endl;
|
---|
| 222 | return(0);
|
---|
| 223 | }
|
---|
| 224 | TypeMap(tokens);
|
---|
| 225 | } else if(kw == "map2double") {
|
---|
| 226 | if(tokens.size()<1) {
|
---|
[2155] | 227 | cout<<"Usage: map2double map"<<endl;
|
---|
| 228 | return(0);
|
---|
| 229 | }
|
---|
| 230 | Map2Double(tokens);
|
---|
[2175] | 231 | } else if(kw == "map2map") {
|
---|
| 232 | if(tokens.size()<2) {
|
---|
| 233 | cout<<"Usage: map2map map type [nside]"<<endl;
|
---|
| 234 | return(0);
|
---|
| 235 | }
|
---|
| 236 | Map2Map(tokens);
|
---|
[2155] | 237 | } else if(kw == "mapmult") {
|
---|
| 238 | if(tokens.size()<2) {
|
---|
| 239 | cout<<"Usage: mapmult map cste"<<endl;
|
---|
| 240 | return(0);
|
---|
| 241 | }
|
---|
| 242 | MapMult(tokens);
|
---|
[2156] | 243 | } else if(kw == "mapcover") {
|
---|
| 244 | if(tokens.size()<1) {
|
---|
[2162] | 245 | cout<<"Usage: mapcover map v1,v2 [varname]"<<endl;
|
---|
[2156] | 246 | return(0);
|
---|
| 247 | }
|
---|
| 248 | MapCover(tokens);
|
---|
[2155] | 249 | } else if(kw == "map2cl") {
|
---|
| 250 | if(tokens.size()<2) {
|
---|
| 251 | cout<<"Usage: map2cl map clvec [lmax] [niter]"<<endl;
|
---|
| 252 | return(0);
|
---|
| 253 | }
|
---|
| 254 | Map2Cl(tokens);
|
---|
[2162] | 255 | } else if(kw == "cl2map") {
|
---|
| 256 | if(tokens.size()<2) {
|
---|
| 257 | cout<<"Usage: cl2map clvec map nside [fwhm]"<<endl;
|
---|
| 258 | return(0);
|
---|
| 259 | }
|
---|
| 260 | Cl2Map(tokens);
|
---|
[2156] | 261 | } else if(kw == "map2alm") {
|
---|
| 262 | if(tokens.size()<2) {
|
---|
| 263 | cout<<"Usage: map2alm map(double) almmat [lmax] [niter]"<<endl;
|
---|
| 264 | return(0);
|
---|
| 265 | }
|
---|
| 266 | Map2Alm(tokens);
|
---|
[2162] | 267 | } else if(kw == "alm2map") {
|
---|
| 268 | if(tokens.size()<3) {
|
---|
| 269 | cout<<"Usage: alm2map almmat map nside"<<endl;
|
---|
| 270 | return(0);
|
---|
| 271 | }
|
---|
| 272 | Alm2Map(tokens);
|
---|
[2155] | 273 | } else if(kw == "crmapmask") {
|
---|
| 274 | if(tokens.size()<2) {
|
---|
[2162] | 275 | cout<<"Usage: crmapmask mapmsk nside lat1,lat2 lon1,lon2 [valmsk,valnomsk]"<<endl;
|
---|
[2155] | 276 | return(0);
|
---|
| 277 | }
|
---|
| 278 | CrMapMask(tokens);
|
---|
| 279 | } else if(kw == "crmaskfrmap") {
|
---|
| 280 | if(tokens.size()<3) {
|
---|
[2162] | 281 | cout<<"Usage: crmaskfrmap mapmsk nside map(double) v1,v2 [valmsk,valnomsk]"<<endl;
|
---|
[2155] | 282 | return(0);
|
---|
| 283 | }
|
---|
| 284 | CrMaskFrMap(tokens);
|
---|
| 285 | } else if(kw == "maskmap") {
|
---|
| 286 | if(tokens.size()<2) {
|
---|
| 287 | cout<<"Usage: maskmap map msk"<<endl;
|
---|
| 288 | return(0);
|
---|
| 289 | }
|
---|
| 290 | MaskMap(tokens);
|
---|
| 291 | } else if(kw == "maproj") {
|
---|
| 292 | if(tokens.size()<2) {
|
---|
| 293 | cout<<"Usage: maproj map mapproj [nside]"<<endl;
|
---|
| 294 | return(0);
|
---|
| 295 | }
|
---|
| 296 | MapProj(tokens);
|
---|
[2162] | 297 | } else if(kw == "map2local") {
|
---|
| 298 | if(tokens.size()<5) {
|
---|
| 299 | cout<<"Usage: map2local map localmap nx,ny angleX,angleY phi0,theta0 [x0,y0] [angle]"<<endl;
|
---|
| 300 | return(0);
|
---|
| 301 | }
|
---|
| 302 | Map2Local(tokens);
|
---|
[2155] | 303 | } else if(kw == "mapop") {
|
---|
| 304 | if(tokens.size()<3) {
|
---|
| 305 | cout<<"Usage: mapop map op map1 [op map2] [op map3] [...]"<<endl;
|
---|
| 306 | return(0);
|
---|
| 307 | }
|
---|
| 308 | MapOper(tokens);
|
---|
[2162] | 309 | } else if(kw == "mapstat") {
|
---|
| 310 | if(tokens.size()<1) {
|
---|
| 311 | cout<<"Usage: Usage: mapstat map [msk] [meanvarname] [sigmavarname]"<<endl;
|
---|
| 312 | return(0);
|
---|
| 313 | }
|
---|
| 314 | MapStat(tokens);
|
---|
[2155] | 315 | }
|
---|
| 316 |
|
---|
| 317 | return(0);
|
---|
| 318 | }
|
---|
| 319 |
|
---|
| 320 | /* --Methode-- */
|
---|
[2175] | 321 | void skymapmoduleExecutor::TypeMap(vector<string>& tokens)
|
---|
| 322 | {
|
---|
| 323 | NamedObjMgr omg;
|
---|
| 324 | AnyDataObj* obj=omg.GetObj(tokens[0]);
|
---|
| 325 | uint_2 t = typemap(obj);
|
---|
| 326 | if(t==UnKnown) {cout<<"TypeMap: UnKnown"<<endl; return;}
|
---|
| 327 |
|
---|
| 328 | int nside = 0;
|
---|
| 329 | if(t&TypeR8) {
|
---|
| 330 | SphericalMap<r_8>* map = dynamic_cast<SphericalMap<r_8>*>(obj);
|
---|
| 331 | nside = map->SizeIndex();
|
---|
| 332 | } else if(t&TypeR4) {
|
---|
| 333 | SphericalMap<r_4>* map = dynamic_cast<SphericalMap<r_4>*>(obj);
|
---|
| 334 | nside = map->SizeIndex();
|
---|
| 335 | }
|
---|
| 336 |
|
---|
| 337 | string dum = "";
|
---|
| 338 | if(t==HealPix8) dum = "SphereHEALPix<r_8>";
|
---|
| 339 | else if(t==HealPix4) dum = "SphereHEALPix<r_4>";
|
---|
| 340 | else if(t==ThetaPhi8) dum = "SphereThetaPhi<r_8>";
|
---|
| 341 | else if(t==ThetaPhi4) dum = "SphereThetaPhi<r_4>";
|
---|
| 342 | else if(t==Spherical8) dum = "SphericalMap<r_8>";
|
---|
| 343 | else if(t==Spherical4) dum = "SphericalMap<r_4>";
|
---|
| 344 |
|
---|
| 345 | cout<<"TypeMap: "<<dum<<" nside="<<nside<<endl;
|
---|
| 346 | }
|
---|
| 347 |
|
---|
| 348 | /* --Methode-- */
|
---|
[2155] | 349 | void skymapmoduleExecutor::Map2Double(vector<string>& tokens)
|
---|
| 350 | {
|
---|
| 351 | NamedObjMgr omg;
|
---|
| 352 | AnyDataObj* obj=omg.GetObj(tokens[0]);
|
---|
| 353 | if(obj==NULL) {
|
---|
| 354 | cout<<"Error: Pas d'objet de nom "<<tokens[0]<<endl;
|
---|
| 355 | return;
|
---|
| 356 | }
|
---|
[2175] | 357 | SphericalMap<r_4>* map = dynamic_cast<SphericalMap<r_4>*>(obj);
|
---|
[2155] | 358 | if(map==NULL) {
|
---|
[2175] | 359 | cout<<"Error: "<<tokens[0]<<" is not a SphericalMap<r_4>"<<endl;
|
---|
[2155] | 360 | return;
|
---|
| 361 | }
|
---|
[2175] | 362 | uint_2 t = typemap(obj);
|
---|
[2155] | 363 | int_4 nside = map->SizeIndex();
|
---|
[2175] | 364 |
|
---|
| 365 | SphericalMap<r_8>* map8 = NULL;
|
---|
| 366 | if(t&HealPix) map8 = new SphereHEALPix<r_8>(nside);
|
---|
| 367 | else if(t&ThetaPhi) map8 = new SphereThetaPhi<r_8>(nside);
|
---|
| 368 | else return;
|
---|
| 369 |
|
---|
| 370 | cout<<"Map2Double: converting to double "<<tokens[0]<<" nside="<<nside<<endl;
|
---|
[2155] | 371 | for(int_4 i=0;i<map8->NbPixels();i++) (*map8)(i) = (r_8) (*map)(i);
|
---|
[2175] | 372 |
|
---|
[2155] | 373 | omg.AddObj(map8,tokens[0]);
|
---|
| 374 | }
|
---|
| 375 |
|
---|
| 376 | /* --Methode-- */
|
---|
[2175] | 377 | void skymapmoduleExecutor::Map2Map(vector<string>& tokens)
|
---|
| 378 | {
|
---|
| 379 | NamedObjMgr omg;
|
---|
| 380 | AnyDataObj* obj=omg.GetObj(tokens[0]);
|
---|
| 381 | if(obj==NULL) {
|
---|
| 382 | cout<<"Error: Pas d'objet de nom "<<tokens[0]<<endl;
|
---|
| 383 | return;
|
---|
| 384 | }
|
---|
| 385 | SphericalMap<r_8>* map = dynamic_cast<SphericalMap<r_8>*>(obj);
|
---|
| 386 | if(map==NULL) {
|
---|
| 387 | cout<<"Error: "<<tokens[0]<<" is not a SphericalMap<r_8>"<<endl;
|
---|
| 388 | return;
|
---|
| 389 | }
|
---|
| 390 | uint_2 t = typemap(obj);
|
---|
| 391 | int_4 nside = map->SizeIndex();
|
---|
| 392 |
|
---|
| 393 | uint_2 tomap = UnKnown;
|
---|
| 394 | if(toupper(tokens[1][0])=='H') tomap = HealPix;
|
---|
| 395 | else if(toupper(tokens[1][0])=='T') tomap = ThetaPhi;
|
---|
| 396 | else {cout<<"unkown map type "<<(char)toupper(tokens[1][0])<<" (H or T)!"<<endl; return;}
|
---|
| 397 | if(t&tomap) {cout<<"map of same type, no conversion done"<<endl; return;}
|
---|
| 398 |
|
---|
| 399 | int_4 tonside = nside;
|
---|
| 400 | if(tokens.size()>2) tonside = atoi(tokens[2].c_str());
|
---|
| 401 | else {
|
---|
| 402 | if(tomap&HealPix) {tonside=int(nside/1.5); GetNSideGood(tonside);}
|
---|
| 403 | else tonside=int(map->NbThetaSlices()/2.5);
|
---|
| 404 | }
|
---|
| 405 | if(tomap&HealPix && !IsNSideGood(tonside))
|
---|
| 406 | {cout<<"Bad nside for Healpix "<<tonside<<endl; return;}
|
---|
| 407 |
|
---|
| 408 | SphericalMap<r_8>* map8 = NULL;
|
---|
| 409 | if(tomap&HealPix) map8 = new SphereHEALPix<r_8>(tonside);
|
---|
| 410 | else if(tomap&ThetaPhi) map8 = new SphereThetaPhi<r_8>(tonside);
|
---|
| 411 | else return;
|
---|
| 412 |
|
---|
| 413 | cout<<"Map2Map: convert "<<tokens[0]<<" nside="<<nside
|
---|
| 414 | <<" to type "<<tokens[1]<<" tonside="<<tonside
|
---|
| 415 | <<" ntheta="<<map->NbThetaSlices()<<" -> "<<map8->NbThetaSlices()<<endl;
|
---|
| 416 |
|
---|
| 417 | for(int_4 i=0;i<map8->NbPixels();i++) {
|
---|
| 418 | double theta,phi; map8->PixThetaPhi(i,theta,phi);
|
---|
| 419 | int_4 ip = map->PixIndexSph(theta,phi);
|
---|
| 420 | if(ip<0 || ip>=map->NbPixels()) continue;
|
---|
| 421 | (*map8)(i)=(*map)(ip);
|
---|
| 422 | }
|
---|
| 423 |
|
---|
| 424 | omg.AddObj(map8,tokens[0]);
|
---|
| 425 | }
|
---|
| 426 |
|
---|
| 427 | /* --Methode-- */
|
---|
[2155] | 428 | void skymapmoduleExecutor::MapMult(vector<string>& tokens)
|
---|
| 429 | {
|
---|
| 430 | NamedObjMgr omg;
|
---|
| 431 | AnyDataObj* obj=omg.GetObj(tokens[0]);
|
---|
| 432 | if(obj==NULL) {
|
---|
| 433 | cout<<"Error: Pas d'objet de nom "<<tokens[0]<<endl;
|
---|
| 434 | return;
|
---|
| 435 | }
|
---|
[2175] | 436 | SphericalMap<r_8>* map = dynamic_cast<SphericalMap<r_8>*>(obj);
|
---|
[2155] | 437 | if(map==NULL) {
|
---|
[2175] | 438 | cout<<"Error: "<<tokens[0]<<" is not a SphericalMap<r_8>"<<endl;
|
---|
[2155] | 439 | return;
|
---|
| 440 | }
|
---|
| 441 | double v = atof(tokens[1].c_str());
|
---|
| 442 | cout<<"MapMult: Multiply "<<tokens[0]<<" by "<<v<<endl;
|
---|
| 443 | for(int_4 i=0;i<map->NbPixels();i++) (*map)(i) *= v;
|
---|
| 444 | }
|
---|
| 445 |
|
---|
| 446 | /* --Methode-- */
|
---|
[2156] | 447 | void skymapmoduleExecutor::MapCover(vector<string>& tokens)
|
---|
| 448 | {
|
---|
| 449 | NamedObjMgr omg;
|
---|
| 450 | AnyDataObj* obj=omg.GetObj(tokens[0]);
|
---|
| 451 | if(obj==NULL) {
|
---|
| 452 | cout<<"Error: Pas d'objet de nom "<<tokens[0]<<endl;
|
---|
| 453 | return;
|
---|
| 454 | }
|
---|
[2175] | 455 | SphericalMap<r_8>* map = dynamic_cast<SphericalMap<r_8>*>(obj);
|
---|
[2156] | 456 | if(map==NULL) {
|
---|
[2175] | 457 | cout<<"Error: "<<tokens[0]<<" is not a SphericalMap<r_8>"<<endl;
|
---|
[2156] | 458 | return;
|
---|
| 459 | }
|
---|
| 460 |
|
---|
| 461 | double v1=0.99, v2=1.01;
|
---|
[2162] | 462 | if(tokens.size()>1) if(tokens[1][0]!='!')
|
---|
| 463 | sscanf(tokens[1].c_str(),"%lf,%lf",&v1,&v2);
|
---|
[2175] | 464 |
|
---|
[2156] | 465 | cout<<"MapCover: "<<tokens[0]<<" good px=["<<v1<<","<<v2<<"]"<<endl;
|
---|
[2175] | 466 |
|
---|
[2156] | 467 | int_4 ngood=0;
|
---|
| 468 | for(int_4 i=0;i<map->NbPixels();i++)
|
---|
| 469 | if(v1<=(*map)(i) && (*map)(i)<=v2) ngood++;
|
---|
| 470 | double per = (double)ngood/(double)map->NbPixels();
|
---|
| 471 | cout<<"NGood="<<ngood<<" NTot="<<map->NbPixels()
|
---|
| 472 | <<" -> "<<100.*per<<" %";
|
---|
[2162] | 473 | if(tokens.size()>2) {
|
---|
| 474 | if(omg.HasVar(tokens[2])) omg.DeleteVar(tokens[2]);
|
---|
[2156] | 475 | char str[128]; sprintf(str,"%g",per);
|
---|
[2162] | 476 | omg.SetVar(tokens[2],(string)str);
|
---|
| 477 | cout<<" stored into $"<<tokens[2];
|
---|
[2156] | 478 | }
|
---|
| 479 | cout<<endl;
|
---|
| 480 | }
|
---|
| 481 |
|
---|
| 482 | /* --Methode-- */
|
---|
[2155] | 483 | void skymapmoduleExecutor::Map2Cl(vector<string>& tokens)
|
---|
| 484 | {
|
---|
| 485 | NamedObjMgr omg;
|
---|
| 486 |
|
---|
| 487 | int_4 lmax=0, niter=3;
|
---|
[2162] | 488 | if(tokens.size()>2) if(tokens[2][0]!='!')
|
---|
| 489 | lmax = atoi(tokens[2].c_str());
|
---|
[2155] | 490 | if(tokens.size()>3) niter = atoi(tokens[3].c_str());
|
---|
| 491 | if(niter<=0) niter = 3;
|
---|
| 492 |
|
---|
| 493 | AnyDataObj* obj=omg.GetObj(tokens[0]);
|
---|
| 494 | if(obj==NULL) {
|
---|
| 495 | cout<<"Error: Pas d'objet de nom "<<tokens[0]<<endl;
|
---|
| 496 | return;
|
---|
| 497 | }
|
---|
[2175] | 498 | SphericalMap<r_8>* map = dynamic_cast<SphericalMap<r_8>*>(obj);
|
---|
[2155] | 499 | if(map==NULL) {
|
---|
[2175] | 500 | cout<<"Error: "<<tokens[0]<<" is not a SphericalMap<r_8>"<<endl;
|
---|
[2155] | 501 | return;
|
---|
| 502 | }
|
---|
[2175] | 503 | uint_2 t = typemap(obj);
|
---|
[2155] | 504 |
|
---|
| 505 | SphericalTransformServer<r_8> ylmserver;
|
---|
| 506 |
|
---|
| 507 | int_4 nside = map->SizeIndex();
|
---|
| 508 | if(lmax<=0) lmax = 3*nside-1;
|
---|
| 509 |
|
---|
| 510 | cout<<"Map2Cl: "<<tokens[0]<<" -> "<<tokens[1]
|
---|
| 511 | <<" lmax="<<lmax<<" niter="<<niter<<endl;
|
---|
| 512 |
|
---|
[2175] | 513 | SphericalMap<r_8>* tmpmap = NULL;
|
---|
| 514 | if(t&HealPix) tmpmap = new SphereHEALPix<r_8>(*((SphereHEALPix<r_8>*)map),false);
|
---|
| 515 | else if(t&ThetaPhi) tmpmap = new SphereThetaPhi<r_8>(*((SphereThetaPhi<r_8>*)map),false);
|
---|
| 516 | else return;
|
---|
[2155] | 517 |
|
---|
[2175] | 518 | TVector<r_8> cltmp = ylmserver.DecomposeToCl(*tmpmap,lmax,0.,niter);
|
---|
| 519 | delete tmpmap;
|
---|
| 520 |
|
---|
| 521 | omg.AddObj(cltmp,tokens[1]);
|
---|
[2155] | 522 | }
|
---|
| 523 |
|
---|
| 524 | /* --Methode-- */
|
---|
[2162] | 525 | void skymapmoduleExecutor::Cl2Map(vector<string>& tokens)
|
---|
| 526 | {
|
---|
| 527 | NamedObjMgr omg;
|
---|
| 528 |
|
---|
| 529 | AnyDataObj* obj=omg.GetObj(tokens[0]);
|
---|
| 530 | if(obj==NULL) {
|
---|
| 531 | cout<<"Error: Pas d'objet de nom "<<tokens[0]<<endl;
|
---|
| 532 | return;
|
---|
| 533 | }
|
---|
| 534 | TVector<r_8>* cl = dynamic_cast<TVector<r_8>*>(obj);
|
---|
| 535 | if(cl==NULL) {
|
---|
| 536 | cout<<"Error: "<<tokens[0]<<" is not a TVector<r_8>"<<endl;
|
---|
| 537 | return;
|
---|
| 538 | }
|
---|
| 539 |
|
---|
| 540 | int nside = 128;
|
---|
| 541 | if(tokens.size()>2) nside = atoi(tokens[2].c_str());
|
---|
[2175] | 542 | if(DefTypMap&HealPix && !IsNSideGood(nside))
|
---|
| 543 | {cout<<"Cl2Map: Bad nside for HealPix "<<nside<<endl; return;}
|
---|
| 544 |
|
---|
[2162] | 545 | double fwhm = 0.;
|
---|
| 546 | if(tokens.size()>3) fwhm = atof(tokens[3].c_str());
|
---|
| 547 |
|
---|
[2175] | 548 | SphericalMap<r_8>* map = NULL;
|
---|
| 549 | if(DefTypMap&HealPix) map = new SphereHEALPix<r_8>;
|
---|
| 550 | else if(DefTypMap&ThetaPhi) map = new SphereThetaPhi<r_8>;
|
---|
| 551 | else return;
|
---|
[2162] | 552 |
|
---|
| 553 | SphericalTransformServer<r_8> ylmserver;
|
---|
| 554 | cout<<"Cl2Map: Generate map "<<tokens[1]<<" with nside="<<nside
|
---|
| 555 | <<" from cl "<<tokens[0]<<" with fwhm="<<fwhm<<endl;
|
---|
| 556 | ylmserver.GenerateFromCl(*map,nside,*cl,fwhm);
|
---|
| 557 |
|
---|
| 558 | omg.AddObj(map,tokens[1]);
|
---|
| 559 | }
|
---|
| 560 |
|
---|
| 561 | /* --Methode-- */
|
---|
[2156] | 562 | void skymapmoduleExecutor::Map2Alm(vector<string>& tokens)
|
---|
| 563 | {
|
---|
| 564 | NamedObjMgr omg;
|
---|
| 565 |
|
---|
| 566 | int_4 lmax=0, niter=3;
|
---|
[2162] | 567 | if(tokens.size()>2) if(tokens[2][0]!='!')
|
---|
| 568 | lmax = atoi(tokens[2].c_str());
|
---|
[2156] | 569 | if(tokens.size()>3) niter = atoi(tokens[3].c_str());
|
---|
| 570 | if(niter<=0) niter = 3;
|
---|
| 571 |
|
---|
| 572 | AnyDataObj* obj=omg.GetObj(tokens[0]);
|
---|
| 573 | if(obj==NULL) {
|
---|
| 574 | cout<<"Error: Pas d'objet de nom "<<tokens[0]<<endl;
|
---|
| 575 | return;
|
---|
| 576 | }
|
---|
[2175] | 577 | SphericalMap<r_8>* map = dynamic_cast<SphericalMap<r_8>*>(obj);
|
---|
[2156] | 578 | if(map==NULL) {
|
---|
[2175] | 579 | cout<<"Error: "<<tokens[0]<<" is not a SphericalMap<r_8>"<<endl;
|
---|
[2156] | 580 | return;
|
---|
| 581 | }
|
---|
[2175] | 582 | uint_2 t = typemap(obj);
|
---|
[2156] | 583 |
|
---|
| 584 | SphericalTransformServer<r_8> ylmserver;
|
---|
| 585 |
|
---|
| 586 | int_4 nside = map->SizeIndex();
|
---|
| 587 | if(lmax<=0) lmax = 3*nside-1;
|
---|
| 588 |
|
---|
| 589 | cout<<"Map2Alm: "<<tokens[0]<<" -> "<<tokens[1]
|
---|
| 590 | <<" lmax="<<lmax<<" niter="<<niter<<endl;
|
---|
| 591 |
|
---|
[2175] | 592 | SphericalMap<r_8>* tmpmap = NULL;
|
---|
| 593 | if(t&HealPix) tmpmap = new SphereHEALPix<r_8>(*((SphereHEALPix<r_8>*)map),false);
|
---|
| 594 | else if(t&ThetaPhi) tmpmap = new SphereThetaPhi<r_8>(*((SphereThetaPhi<r_8>*)map),false);
|
---|
| 595 | else return;
|
---|
| 596 |
|
---|
[2156] | 597 | Alm<r_8> almtmp;
|
---|
[2175] | 598 | ylmserver.DecomposeToAlm(*tmpmap,almtmp,lmax,0.,niter);
|
---|
| 599 | delete tmpmap;
|
---|
[2156] | 600 |
|
---|
| 601 | int n = almtmp.rowNumber();
|
---|
| 602 | TMatrix< complex<r_8> >* alm = new TMatrix< complex<r_8> >(n,n);
|
---|
| 603 | *alm = (complex<r_8>)0.;
|
---|
| 604 | for(int i=0;i<n;i++) for(int j=0;j<=i;j++) (*alm)(i,j)=almtmp(i,j);
|
---|
| 605 | omg.AddObj(alm,tokens[1]);
|
---|
| 606 | }
|
---|
| 607 |
|
---|
| 608 | /* --Methode-- */
|
---|
[2162] | 609 | void skymapmoduleExecutor::Alm2Map(vector<string>& tokens)
|
---|
| 610 | {
|
---|
| 611 | NamedObjMgr omg;
|
---|
| 612 |
|
---|
| 613 | AnyDataObj* obj=omg.GetObj(tokens[0]);
|
---|
| 614 | if(obj==NULL) {
|
---|
| 615 | cout<<"Error: Pas d'objet de nom "<<tokens[0]<<endl;
|
---|
| 616 | return;
|
---|
| 617 | }
|
---|
| 618 | TMatrix< complex<r_8> >* almmat = dynamic_cast<TMatrix< complex<r_8> >*>(obj);
|
---|
| 619 | if(almmat==NULL) {
|
---|
| 620 | cout<<"Error: "<<tokens[0]<<" is not a TMatrix< complex<r_8> >"<<endl;
|
---|
| 621 | return;
|
---|
| 622 | }
|
---|
| 623 |
|
---|
| 624 | int lmax = almmat->NRows()-1;
|
---|
| 625 | Alm<r_8> alm(lmax);
|
---|
| 626 | alm = (complex<r_8>)0.;
|
---|
| 627 | for(int i=0;i<lmax+1;i++) for(int j=0;j<=i;j++) alm(i,j)=(*almmat)(i,j);
|
---|
| 628 |
|
---|
| 629 | int nside = 128;
|
---|
| 630 | if(tokens.size()>2) nside = atoi(tokens[2].c_str());
|
---|
[2175] | 631 | if(DefTypMap&HealPix && !IsNSideGood(nside))
|
---|
| 632 | {cout<<"Alm2Map: Bad nside for HealPix "<<nside<<endl; return;}
|
---|
[2162] | 633 |
|
---|
[2175] | 634 | SphericalMap<r_8>* map = NULL;
|
---|
| 635 | if(DefTypMap&HealPix) map = new SphereHEALPix<r_8>;
|
---|
| 636 | else if(DefTypMap&ThetaPhi) map = new SphereThetaPhi<r_8>;
|
---|
| 637 | else return;
|
---|
| 638 |
|
---|
[2162] | 639 | SphericalTransformServer<r_8> ylmserver;
|
---|
| 640 | cout<<"Alm2Map: Generate map "<<tokens[1]<<" with nside="<<nside
|
---|
| 641 | <<" from alm "<<tokens[0]<<endl;
|
---|
| 642 | ylmserver.GenerateFromAlm(*map,nside,alm);
|
---|
| 643 |
|
---|
| 644 | omg.AddObj(map,tokens[1]);
|
---|
| 645 | }
|
---|
| 646 |
|
---|
| 647 | /* --Methode-- */
|
---|
[2155] | 648 | void skymapmoduleExecutor::CrMapMask(vector<string>& tokens)
|
---|
| 649 | {
|
---|
| 650 | NamedObjMgr omg;
|
---|
| 651 |
|
---|
| 652 | int_4 nside = atoi(tokens[1].c_str());
|
---|
[2175] | 653 | if(DefTypMap&HealPix && !IsNSideGood(nside))
|
---|
| 654 | {cout<<"CrMapMask: Bad nside "<<nside<<endl; return;}
|
---|
[2155] | 655 |
|
---|
[2175] | 656 | SphericalMap<r_8>* map = NULL;
|
---|
| 657 | if(DefTypMap&HealPix) map = new SphereHEALPix<r_8>(nside);
|
---|
| 658 | else if(DefTypMap&ThetaPhi) map = new SphereThetaPhi<r_8>(nside);
|
---|
| 659 | else return;
|
---|
[2155] | 660 |
|
---|
[2162] | 661 | bool lat=false, lon=false;
|
---|
| 662 | double lat1=-99., lat2=99., lon1=-999., lon2=999.;
|
---|
| 663 | if(tokens.size()>2) if(tokens[2][0]!='!')
|
---|
| 664 | {lat=true; sscanf(tokens[2].c_str(),"%lf,%lf",&lat1,&lat2);}
|
---|
| 665 | if(tokens.size()>3) if(tokens[3][0]!='!')
|
---|
| 666 | {lon=true; sscanf(tokens[3].c_str(),"%lf,%lf",&lon1,&lon2);}
|
---|
[2155] | 667 |
|
---|
| 668 | double valmsk=0., unvalmsk=1.;
|
---|
[2162] | 669 | if(tokens.size()>4) sscanf(tokens[4].c_str(),"%lf,%lf",&valmsk,&unvalmsk);
|
---|
[2155] | 670 |
|
---|
[2162] | 671 | cout<<"CrMapMask "<<tokens[0]<<" nside="<<nside;
|
---|
| 672 | if(lat) cout<<" for latitude in ["<<lat1<<","<<lat2<<"]";
|
---|
| 673 | if(lon) cout<<" for longitude in ["<<lon1<<","<<lon2<<"]";
|
---|
| 674 | cout<<" valmsk="<<valmsk<<" unvalmsk="<<unvalmsk<<endl;
|
---|
[2155] | 675 |
|
---|
[2162] | 676 | //Attention: conversion en co-latitude ==> inversion: [lat2,lat1]
|
---|
[2155] | 677 | lat1 = (90.-lat1)*M_PI/180.; lat2 = (90.-lat2)*M_PI/180.;
|
---|
[2162] | 678 | lon1 *= M_PI/180.; lon2 *= M_PI/180.;
|
---|
[2155] | 679 | for(int_4 i=0;i<map->NbPixels();i++) {
|
---|
[2162] | 680 | (*map)(i)=unvalmsk;
|
---|
| 681 | if(!lat && !lon) continue;
|
---|
| 682 | double theta,phi; map->PixThetaPhi(i,theta,phi);
|
---|
| 683 | if(lat && (theta<lat2 || lat1<theta)) continue;
|
---|
| 684 | if(lon && ( phi<lon1 || lon2<phi )) continue;
|
---|
| 685 | (*map)(i)=valmsk;
|
---|
[2155] | 686 | }
|
---|
| 687 |
|
---|
| 688 | omg.AddObj(map,tokens[0]);
|
---|
| 689 | }
|
---|
| 690 |
|
---|
| 691 | /* --Methode-- */
|
---|
| 692 | void skymapmoduleExecutor::CrMaskFrMap(vector<string>& tokens)
|
---|
| 693 | {
|
---|
| 694 | NamedObjMgr omg;
|
---|
| 695 |
|
---|
| 696 | AnyDataObj* obj=omg.GetObj(tokens[2]);
|
---|
| 697 | if(obj==NULL) {
|
---|
[2162] | 698 | cout<<"Error: Pas d'objet de nom "<<tokens[2]<<endl;
|
---|
[2155] | 699 | return;
|
---|
| 700 | }
|
---|
[2175] | 701 | SphericalMap<r_8>* map = dynamic_cast<SphericalMap<r_8>*>(obj);
|
---|
[2155] | 702 | if(map==NULL) {
|
---|
[2175] | 703 | cout<<"Error: "<<tokens[2]<<" is not a SphericalMap<r_8>"<<endl;
|
---|
[2155] | 704 | return;
|
---|
| 705 | }
|
---|
[2175] | 706 | uint_2 t = typemap(obj);
|
---|
[2155] | 707 |
|
---|
[2175] | 708 | int_4 nside = atoi(tokens[1].c_str());
|
---|
| 709 | if(nside<=1) return;
|
---|
| 710 | if(t&HealPix && !IsNSideGood(nside))
|
---|
| 711 | {cout<<"CrMapMask: Bad nside for HealPix "<<nside<<endl; return;}
|
---|
[2155] | 712 |
|
---|
[2175] | 713 | SphericalMap<r_8>* msk = NULL;
|
---|
| 714 | if(t&HealPix) msk = new SphereHEALPix<r_8>(nside);
|
---|
| 715 | else if(t&ThetaPhi) msk = new SphereThetaPhi<r_8>(nside);
|
---|
| 716 | else return;
|
---|
| 717 |
|
---|
[2162] | 718 | double v1=-1.e100, v2=1.e100;
|
---|
| 719 | if(tokens.size()>3) if(tokens[3][0]!='!')
|
---|
| 720 | sscanf(tokens[3].c_str(),"%lf,%lf",&v1,&v2);
|
---|
[2155] | 721 |
|
---|
| 722 | double valmsk=0., unvalmsk=1.;
|
---|
[2162] | 723 | if(tokens.size()>4) sscanf(tokens[4].c_str(),"%lf,%lf",&valmsk,&unvalmsk);
|
---|
[2155] | 724 |
|
---|
[2175] | 725 | cout<<"CrMaskFrMap "<<tokens[0]<<" nside="<<nside<<" with "<<tokens[2]<<endl
|
---|
[2155] | 726 | <<" for value in ["<<v1<<","<<v2<<"]"
|
---|
| 727 | <<" valmsk="<<valmsk<<" unvalmsk="<<unvalmsk<<endl;
|
---|
| 728 |
|
---|
| 729 | for(int_4 i=0;i<msk->NbPixels();i++) {
|
---|
[2162] | 730 | double theta,phi; msk->PixThetaPhi(i,theta,phi);
|
---|
[2155] | 731 | int_4 ip = map->PixIndexSph(theta,phi);
|
---|
| 732 | if(ip<0 || ip>=map->NbPixels()) continue;
|
---|
| 733 | double v = (*map)(ip);
|
---|
| 734 | if(v>v1 && v<v2) (*msk)(i)=valmsk;
|
---|
| 735 | else (*msk)(i)=unvalmsk;
|
---|
| 736 | }
|
---|
| 737 |
|
---|
| 738 | omg.AddObj(msk,tokens[0]);
|
---|
| 739 | }
|
---|
| 740 |
|
---|
| 741 | /* --Methode-- */
|
---|
| 742 | void skymapmoduleExecutor::MaskMap(vector<string>& tokens)
|
---|
| 743 | {
|
---|
| 744 | NamedObjMgr omg;
|
---|
| 745 |
|
---|
| 746 | AnyDataObj* obj=omg.GetObj(tokens[0]);
|
---|
| 747 | if(obj==NULL) {
|
---|
| 748 | cout<<"Error: Pas d'objet de nom "<<tokens[0]<<endl;
|
---|
| 749 | return;
|
---|
| 750 | }
|
---|
[2175] | 751 | SphericalMap<r_8>* map = dynamic_cast<SphericalMap<r_8>*>(obj);
|
---|
[2155] | 752 | if(map==NULL) {
|
---|
[2175] | 753 | cout<<"Error: "<<tokens[0]<<" is not a SphericalMap<r_8>"<<endl;
|
---|
[2155] | 754 | return;
|
---|
| 755 | }
|
---|
| 756 |
|
---|
| 757 | AnyDataObj* objm=omg.GetObj(tokens[1]);
|
---|
| 758 | if(obj==NULL) {
|
---|
| 759 | cout<<"Error: Pas d'objet de nom "<<tokens[1]<<endl;
|
---|
| 760 | return;
|
---|
| 761 | }
|
---|
[2175] | 762 | SphericalMap<r_8>* msk = dynamic_cast<SphericalMap<r_8>*>(objm);
|
---|
[2155] | 763 | if(msk==NULL) {
|
---|
[2175] | 764 | cout<<"Error: "<<tokens[1]<<" is not a SphericalMap<r_8>"<<endl;
|
---|
[2155] | 765 | return;
|
---|
| 766 | }
|
---|
| 767 |
|
---|
| 768 | cout<<"MskMap: "<<tokens[0]<<" with mask "<<tokens[1]<<endl;
|
---|
| 769 |
|
---|
| 770 | for(int_4 i=0;i<map->NbPixels();i++) {
|
---|
[2162] | 771 | double theta,phi; map->PixThetaPhi(i,theta,phi);
|
---|
[2155] | 772 | int_4 ip = msk->PixIndexSph(theta,phi);
|
---|
| 773 | if(ip<0 || ip>=msk->NbPixels()) continue;
|
---|
| 774 | (*map)(i) *= (*msk)(ip);
|
---|
| 775 | }
|
---|
| 776 |
|
---|
| 777 | }
|
---|
| 778 |
|
---|
| 779 | /* --Methode-- */
|
---|
| 780 | void skymapmoduleExecutor::MapProj(vector<string>& tokens)
|
---|
| 781 | {
|
---|
| 782 | NamedObjMgr omg;
|
---|
| 783 |
|
---|
| 784 | AnyDataObj* obj=omg.GetObj(tokens[0]);
|
---|
| 785 | if(obj==NULL) {
|
---|
| 786 | cout<<"Error: Pas d'objet de nom "<<tokens[0]<<endl;
|
---|
| 787 | return;
|
---|
| 788 | }
|
---|
[2175] | 789 | SphericalMap<r_8>* map = dynamic_cast<SphericalMap<r_8>*>(obj);
|
---|
[2155] | 790 | if(map==NULL) {
|
---|
[2175] | 791 | cout<<"Error: "<<tokens[0]<<" is not a SphericalMap<r_8>"<<endl;
|
---|
[2155] | 792 | return;
|
---|
| 793 | }
|
---|
| 794 | int_4 nsidemap = map->SizeIndex();
|
---|
[2175] | 795 | uint_2 t = typemap(obj);
|
---|
[2155] | 796 |
|
---|
| 797 | int_4 nside = nsidemap;
|
---|
| 798 | if(tokens.size()>2) nside = atoi(tokens[2].c_str());
|
---|
[2175] | 799 | if(t&HealPix && !IsNSideGood(nside))
|
---|
| 800 | {cout<<"MapProj: Bad nside for Healpix "<<nside<<endl; return;}
|
---|
[2155] | 801 |
|
---|
[2175] | 802 | SphericalMap<r_8>* mapproj = NULL;
|
---|
| 803 | if(t&HealPix) mapproj = new SphereHEALPix<r_8>(nside);
|
---|
| 804 | else if(t&ThetaPhi) mapproj = new SphereThetaPhi<r_8>(nside);
|
---|
| 805 | else return;
|
---|
[2155] | 806 |
|
---|
[2175] | 807 | cout<<"MapProj: project "<<tokens[0]<<" n="<<nsidemap
|
---|
| 808 | <<" to "<<tokens[1]<<" n="<<nside<<endl;
|
---|
| 809 |
|
---|
[2155] | 810 | if(nsidemap==nside) { // tailles egales
|
---|
| 811 | for(int_4 i=0;i<mapproj->NbPixels();i++)
|
---|
| 812 | (*mapproj)(i) = (*map)(i);
|
---|
| 813 | } else if(nsidemap<nside) { // mapproj>map
|
---|
| 814 | for(int_4 i=0;i<mapproj->NbPixels();i++) {
|
---|
[2162] | 815 | double theta,phi; mapproj->PixThetaPhi(i,theta,phi);
|
---|
[2155] | 816 | int_4 ip = map->PixIndexSph(theta,phi);
|
---|
| 817 | if(ip<0 || ip>=map->NbPixels()) continue;
|
---|
| 818 | (*mapproj)(i) = (*map)(ip);
|
---|
| 819 | }
|
---|
| 820 | } else { // mapproj<map
|
---|
[2175] | 821 | SphericalMap<int_4>* nproj= NULL;
|
---|
| 822 | if(t&HealPix) nproj= new SphereHEALPix<int_4>(nside);
|
---|
| 823 | else if(t&ThetaPhi) nproj= new SphereThetaPhi<int_4>(nside);
|
---|
| 824 | for(int_4 i=0;i<nproj->NbPixels();i++) {(*nproj)(i)=0;(*mapproj)(i)=0.;}
|
---|
[2155] | 825 | for(int_4 i=0;i<map->NbPixels();i++) {
|
---|
[2162] | 826 | double theta,phi; map->PixThetaPhi(i,theta,phi);
|
---|
[2155] | 827 | int_4 ip = mapproj->PixIndexSph(theta,phi);
|
---|
| 828 | if(ip<0 || ip>=mapproj->NbPixels()) continue;
|
---|
| 829 | (*mapproj)(ip) += (*map)(i);
|
---|
[2175] | 830 | (*nproj)(ip)++;
|
---|
[2155] | 831 | }
|
---|
| 832 | for(int_4 i=0;i<mapproj->NbPixels();i++)
|
---|
[2175] | 833 | (*mapproj)(i) /= (r_8) (*nproj)(i);
|
---|
| 834 | delete nproj;
|
---|
[2155] | 835 | }
|
---|
| 836 |
|
---|
| 837 | omg.AddObj(mapproj,tokens[1]);
|
---|
| 838 | }
|
---|
| 839 |
|
---|
| 840 | /* --Methode-- */
|
---|
[2162] | 841 | void skymapmoduleExecutor::Map2Local(vector<string>& tokens)
|
---|
| 842 | {
|
---|
| 843 | NamedObjMgr omg;
|
---|
| 844 |
|
---|
| 845 | AnyDataObj* obj=omg.GetObj(tokens[0]);
|
---|
| 846 | if(obj==NULL) {
|
---|
| 847 | cout<<"Error: Pas d'objet de nom "<<tokens[0]<<endl;
|
---|
| 848 | return;
|
---|
| 849 | }
|
---|
[2175] | 850 | SphericalMap<r_8>* map = dynamic_cast<SphericalMap<r_8>*>(obj);
|
---|
[2162] | 851 | if(map==NULL) {
|
---|
[2175] | 852 | cout<<"Error: "<<tokens[0]<<" is not a SphericalMap<r_8>"<<endl;
|
---|
[2162] | 853 | return;
|
---|
| 854 | }
|
---|
| 855 |
|
---|
| 856 | int_4 nx=10,ny=10;
|
---|
| 857 | if(tokens.size()>2) sscanf(tokens[2].c_str(),"%d,%d",&nx,&ny);
|
---|
| 858 | if(nx<=0)
|
---|
| 859 | {cout<<"Error: nx="<<nx<<" value >0"<<endl; return;}
|
---|
| 860 | if(ny<=0)
|
---|
| 861 | {cout<<"Error: ny="<<ny<<" value >0"<<endl; return;}
|
---|
| 862 |
|
---|
| 863 | double angleX=1., angleY=1.;
|
---|
| 864 | if(tokens.size()>3) sscanf(tokens[3].c_str(),"%lf,%lf",&angleX,&angleY);
|
---|
| 865 | if(angleX<=0. || angleX>180.)
|
---|
| 866 | {cout<<"Error: bad angleX="<<angleX<<" value #]0,180]"<<endl; return;}
|
---|
| 867 | if(angleY<=0. || angleY>180.)
|
---|
| 868 | {cout<<"Error: bad angleY="<<angleY<<" value #]0,180]"<<endl; return;}
|
---|
| 869 |
|
---|
| 870 | double phi0=0., theta0=0.;
|
---|
| 871 | if(tokens.size()>4) sscanf(tokens[4].c_str(),"%lf,%lf",&phi0,&theta0);
|
---|
| 872 | if(phi0<0. || phi0>=360.)
|
---|
| 873 | {cout<<"Error: bad phi0="<<phi0<<" value #[0,360["<<endl; return;}
|
---|
| 874 | if(theta0<-90. || theta0>90.)
|
---|
| 875 | {cout<<"Error: bad theta0="<<theta0<<" value #[-90,90]"<<endl; return;}
|
---|
| 876 |
|
---|
| 877 | int_4 x0=nx/2, y0=ny/2;
|
---|
| 878 | if(tokens.size()>5) if(tokens[5][0]!='!')
|
---|
| 879 | sscanf(tokens[5].c_str(),"%d,%d",&x0,&y0);
|
---|
| 880 |
|
---|
| 881 | double angle=0.;
|
---|
| 882 | if(tokens.size()>6) sscanf(tokens[6].c_str(),"%lf",&angle);
|
---|
| 883 |
|
---|
| 884 | cout<<"Map2Local: proj "<<tokens[0]<<" to local "<<tokens[1]<<endl
|
---|
| 885 | <<" nx="<<nx<<" ny="<<ny<<" angleX="<<angleX<<" angleY="<<angleY
|
---|
| 886 | <<" phi0="<<phi0<<" theta0="<<theta0<<" x0="<<x0<<" y0="<<y0
|
---|
| 887 | <<" angle="<<angle<<endl;
|
---|
| 888 | if(angle<-90. || angle>90.)
|
---|
| 889 | {cout<<"Error: bad angle="<<angle<<" value #[-90,90]"<<endl; return;}
|
---|
| 890 |
|
---|
| 891 | theta0 = (90.-theta0);
|
---|
| 892 | LocalMap<r_8>* lmap = new LocalMap<r_8>(nx,ny,angleX,angleY,theta0,phi0,x0,y0,angle);
|
---|
| 893 | *lmap = 0.; //lmap->print(cout);
|
---|
| 894 |
|
---|
| 895 | int_4 nbad=0;
|
---|
| 896 | double tmax=-9999., pmax=-9999., tmin=9999., pmin=9999.;
|
---|
| 897 | for(int_4 i=0;i<lmap->NbPixels();i++) {
|
---|
| 898 | double theta,phi;
|
---|
| 899 | lmap->PixThetaPhi(i,theta,phi);
|
---|
| 900 | int_4 ip = map->PixIndexSph(theta,phi);
|
---|
| 901 | if(ip<0 || ip>=map->NbPixels()) {nbad++; continue;}
|
---|
| 902 | if(theta<tmin) tmin=theta; if(theta>tmax) tmax=theta;
|
---|
| 903 | if(phi<pmin) pmin=phi; if(phi>pmax) pmax=phi;
|
---|
| 904 | (*lmap)(i) = (*map)(ip);
|
---|
| 905 | }
|
---|
| 906 | if(nbad) cout<<"Warning: "<<nbad<<" bad pixels numbers"<<endl;
|
---|
| 907 | cout<<" phi=["<<pmin/M_PI*180.<<","<<pmax/M_PI*180.<<"]="
|
---|
| 908 | <<(pmax-pmin)/M_PI*180.
|
---|
| 909 | <<" theta=["<<tmin/M_PI*180.<<","<<tmax/M_PI*180.<<"]="
|
---|
| 910 | <<(tmax-tmin)/M_PI*180.<<endl;
|
---|
| 911 |
|
---|
| 912 | omg.AddObj(lmap,tokens[1]);
|
---|
| 913 | }
|
---|
| 914 |
|
---|
| 915 | /* --Methode-- */
|
---|
[2155] | 916 | void skymapmoduleExecutor::MapOper(vector<string>& tokens)
|
---|
| 917 | {
|
---|
| 918 | NamedObjMgr omg;
|
---|
| 919 |
|
---|
| 920 | AnyDataObj* obj=omg.GetObj(tokens[0]);
|
---|
| 921 | if(obj==NULL) {
|
---|
| 922 | cout<<"Error: Pas d'objet de nom "<<tokens[0]<<endl;
|
---|
| 923 | return;
|
---|
| 924 | }
|
---|
[2175] | 925 | SphericalMap<r_8>* map = dynamic_cast<SphericalMap<r_8>*>(obj);
|
---|
[2155] | 926 | if(map==NULL) {
|
---|
[2175] | 927 | cout<<"Error: "<<tokens[0]<<" is not a SphericalMap<r_8>"<<endl;
|
---|
[2155] | 928 | return;
|
---|
| 929 | }
|
---|
| 930 |
|
---|
| 931 | cout<<"MapOper: "<<tokens[0];
|
---|
| 932 | for(unsigned short iop=1;iop<tokens.size()-1;iop+=2) {
|
---|
| 933 | char op = tokens[iop][0];
|
---|
| 934 | if(op!='+' && op!='-' && op!='*' && op!='/') continue;
|
---|
| 935 | AnyDataObj* obj1=omg.GetObj(tokens[iop+1]);
|
---|
| 936 | if(obj1==NULL)
|
---|
| 937 | {cout<<"Error: Pas d'objet de nom "<<tokens[iop+1]<<endl;
|
---|
| 938 | continue;}
|
---|
[2175] | 939 | SphericalMap<r_8>* map1 = dynamic_cast<SphericalMap<r_8>*>(obj1);
|
---|
[2155] | 940 | if(map1==NULL)
|
---|
[2175] | 941 | {cout<<"Error: "<<tokens[iop+1]<<" is not a SphericalMap<r_8>"<<endl;
|
---|
[2155] | 942 | continue;}
|
---|
| 943 | cout<<" "<<op<<"= "<<tokens[iop+1];
|
---|
| 944 | for(int_4 i=0;i<map->NbPixels();i++) {
|
---|
[2162] | 945 | double theta,phi; map->PixThetaPhi(i,theta,phi);
|
---|
[2155] | 946 | int_4 ip = map1->PixIndexSph(theta,phi);
|
---|
| 947 | if(ip<0 || ip>=map1->NbPixels()) continue;
|
---|
| 948 | if(op=='+') (*map)(i) += (*map1)(ip);
|
---|
| 949 | else if(op=='-') (*map)(i) -= (*map1)(ip);
|
---|
| 950 | else if(op=='*') (*map)(i) *= (*map1)(ip);
|
---|
| 951 | else if(op=='/')
|
---|
| 952 | {if((*map1)(ip)!=0.) (*map)(i) /= (*map1)(ip);
|
---|
| 953 | else (*map)(i) = 0.;}
|
---|
| 954 | }
|
---|
| 955 | }
|
---|
| 956 | cout<<endl;
|
---|
| 957 | }
|
---|
| 958 |
|
---|
[2162] | 959 | /* --Methode-- */
|
---|
| 960 | void skymapmoduleExecutor::MapStat(vector<string>& tokens)
|
---|
| 961 | {
|
---|
| 962 | NamedObjMgr omg;
|
---|
| 963 |
|
---|
| 964 | AnyDataObj* obj=omg.GetObj(tokens[0]);
|
---|
| 965 | if(obj==NULL) {
|
---|
| 966 | cout<<"Error: Pas d'objet de nom "<<tokens[1]<<endl;
|
---|
| 967 | return;
|
---|
| 968 | }
|
---|
[2175] | 969 | SphericalMap<r_8>* map = dynamic_cast<SphericalMap<r_8>*>(obj);
|
---|
[2162] | 970 | if(map==NULL) {
|
---|
[2175] | 971 | cout<<"Error: "<<tokens[0]<<" is not a SphericalMap<r_8>"<<endl;
|
---|
[2162] | 972 | return;
|
---|
| 973 | }
|
---|
| 974 |
|
---|
[2175] | 975 | SphericalMap<r_8>* msk = NULL;
|
---|
[2162] | 976 | if(tokens.size()>1) {
|
---|
| 977 | if(tokens[1][0]!='!') {
|
---|
| 978 | AnyDataObj* objm=omg.GetObj(tokens[1]);
|
---|
| 979 | if(objm==NULL) {
|
---|
| 980 | cout<<"Error: Pas d'objet de nom "<<tokens[1]<<endl;
|
---|
| 981 | return;
|
---|
| 982 | }
|
---|
[2175] | 983 | msk = dynamic_cast<SphericalMap<r_8>*>(objm);
|
---|
[2162] | 984 | if(msk==NULL) {
|
---|
[2175] | 985 | cout<<"Error: "<<tokens[1]<<" is not a SphericalMap<r_8>"<<endl;
|
---|
[2162] | 986 | return;
|
---|
| 987 | }
|
---|
| 988 | }
|
---|
| 989 | }
|
---|
| 990 |
|
---|
| 991 | cout<<"MapStat for map "<<tokens[0];
|
---|
| 992 | if(msk) cout<<" using mask "<<tokens[1];
|
---|
| 993 | cout<<endl;
|
---|
| 994 |
|
---|
| 995 | double sum=0., sum2=0., sumw=0.;
|
---|
| 996 | int npix = map->NbPixels(), npixgood=0;
|
---|
| 997 | for(int_4 i=0;i<npix;i++) {
|
---|
| 998 | double w = 1.;
|
---|
| 999 | if(msk) {
|
---|
| 1000 | double theta,phi; map->PixThetaPhi(i,theta,phi);
|
---|
| 1001 | int_4 ip = msk->PixIndexSph(theta,phi);
|
---|
| 1002 | if(ip<0 || ip>=msk->NbPixels()) w=0.;
|
---|
| 1003 | else w=(*msk)(ip);
|
---|
| 1004 | }
|
---|
| 1005 | if(w<=0.) continue;
|
---|
| 1006 | npixgood++; sumw += w;
|
---|
| 1007 | sum += (*map)(i)*w;
|
---|
| 1008 | sum2 += (*map)(i)*(*map)(i)*w*w;
|
---|
| 1009 | }
|
---|
| 1010 | if(sumw<=0. || npixgood==0) {
|
---|
| 1011 | sum = sum2 = sumw=0.;
|
---|
| 1012 | } else {
|
---|
| 1013 | sum /= sumw;
|
---|
| 1014 | sum2 = sum2/sumw - sum*sum;
|
---|
| 1015 | if(sum2<=0.) sum2=0.; else sum2=sqrt(sum2);
|
---|
| 1016 | }
|
---|
| 1017 | cout<<"Number of good px="<<npixgood<<" / "<<npix
|
---|
| 1018 | <<" ("<<100.*npixgood/npix<<" %)"<<endl;
|
---|
| 1019 | cout<<" mean="<<sum<<" sigma="<<sum2<<endl;
|
---|
| 1020 |
|
---|
| 1021 | if(tokens.size()>2) if(tokens[2][0]!='!') {
|
---|
| 1022 | if(omg.HasVar(tokens[2])) omg.DeleteVar(tokens[2]);
|
---|
| 1023 | char str[128]; sprintf(str,"%.8f",sum);
|
---|
| 1024 | omg.SetVar(tokens[2],(string)str);
|
---|
| 1025 | cout<<" mean stored into $"<<tokens[2];
|
---|
| 1026 | }
|
---|
| 1027 | if(tokens.size()>3) if(tokens[3][0]!='!') {
|
---|
| 1028 | if(omg.HasVar(tokens[3])) omg.DeleteVar(tokens[3]);
|
---|
| 1029 | char str[128]; sprintf(str,"%.8f",sum2);
|
---|
| 1030 | omg.SetVar(tokens[3],(string)str);
|
---|
| 1031 | cout<<" sigma stored into $"<<tokens[3];
|
---|
| 1032 | }
|
---|
| 1033 | if(tokens.size()>2) cout<<endl;
|
---|
| 1034 |
|
---|
| 1035 | }
|
---|
| 1036 |
|
---|
[2155] | 1037 | ////////////////////////////////////////////////////////////
|
---|
[2175] | 1038 |
|
---|
| 1039 | /* --Methode-- */
|
---|
| 1040 | void skymapmoduleExecutor::SetTypeMap(vector<string>& tokens)
|
---|
| 1041 | {
|
---|
| 1042 | if(tokens.size()<1) {
|
---|
| 1043 | cout<<"SetTypeMap: Usage: settypemap type"<<endl;
|
---|
| 1044 | } else {
|
---|
| 1045 | if(toupper(tokens[0][0])=='H') DefTypMap = HealPix;
|
---|
| 1046 | else if(toupper(tokens[0][0])=='T') DefTypMap = ThetaPhi;
|
---|
| 1047 | else cout<<"unkown map type, should be (H or T)!"<<endl;
|
---|
| 1048 | }
|
---|
| 1049 | string dum;
|
---|
| 1050 | if(DefTypMap&HealPix) dum="HealPix";
|
---|
| 1051 | else if(DefTypMap&ThetaPhi) dum="ThetaPhi";
|
---|
| 1052 | cout<<"SetTypeMap: type map is "<<dum<<" ("<<DefTypMap<<")"<<endl;
|
---|
| 1053 | }
|
---|
| 1054 |
|
---|
| 1055 | /* --Methode-- */
|
---|
| 1056 | bool skymapmoduleExecutor::IsNSideGood(int_4 nside)
|
---|
| 1057 | {
|
---|
| 1058 | if(nside<=1) return false;
|
---|
| 1059 | while(nside>1) {if(nside%2!=0) return false; else nside/=2;}
|
---|
| 1060 | return true;
|
---|
| 1061 | }
|
---|
| 1062 |
|
---|
| 1063 | /* --Methode-- */
|
---|
| 1064 | void skymapmoduleExecutor::GetNSideGood(int_4 &nside)
|
---|
| 1065 | // get the nearest good nside for HealPix
|
---|
| 1066 | {
|
---|
| 1067 | double n=1.e50; int_4 ns=nside;
|
---|
| 1068 | for(int_4 i=1;i<66000;i*=2) {
|
---|
| 1069 | double v = fabs((double)(nside-i));
|
---|
| 1070 | if(v>n) continue;
|
---|
| 1071 | n=v; ns=i;
|
---|
| 1072 | }
|
---|
| 1073 | nside = ns;
|
---|
| 1074 | }
|
---|
| 1075 |
|
---|
| 1076 | /* --Methode-- */
|
---|
| 1077 | uint_2 skymapmoduleExecutor::typemap(AnyDataObj* obj)
|
---|
| 1078 | {
|
---|
| 1079 | if(obj==NULL) return UnKnown;
|
---|
| 1080 | if(dynamic_cast<SphereHEALPix<r_4> *>(obj)) return HealPix4;
|
---|
| 1081 | if(dynamic_cast<SphereHEALPix<r_8> *>(obj)) return HealPix8;
|
---|
| 1082 | if(dynamic_cast<SphereThetaPhi<r_4>*>(obj)) return ThetaPhi4;
|
---|
| 1083 | if(dynamic_cast<SphereThetaPhi<r_8>*>(obj)) return ThetaPhi8;
|
---|
| 1084 | if(dynamic_cast<SphericalMap<r_4> *>(obj)) return Spherical4;
|
---|
| 1085 | if(dynamic_cast<SphericalMap<r_8> *>(obj)) return Spherical8;
|
---|
| 1086 | return UnKnown;
|
---|
| 1087 | }
|
---|
| 1088 |
|
---|
| 1089 | ////////////////////////////////////////////////////////////
|
---|
[2155] | 1090 | static skymapmoduleExecutor * piaskmex = NULL;
|
---|
| 1091 |
|
---|
| 1092 | void skymapmodule_init()
|
---|
| 1093 | {
|
---|
| 1094 | if (piaskmex) delete piaskmex;
|
---|
| 1095 | piaskmex = new skymapmoduleExecutor;
|
---|
| 1096 | }
|
---|
| 1097 |
|
---|
| 1098 | void skymapmodule_end()
|
---|
| 1099 | {
|
---|
| 1100 | // Desactivation du module
|
---|
| 1101 | if (piaskmex) delete piaskmex;
|
---|
| 1102 | piaskmex = NULL;
|
---|
| 1103 | }
|
---|