many bug fixes from the previous update; new changes appear to work now

This commit is contained in:
P.M. Sutter 2012-11-18 14:23:50 -06:00
parent 90964d2be3
commit 0b54a31d0c
7 changed files with 72 additions and 21 deletions

View file

@ -54,3 +54,33 @@ void computeContourPixels(Healpix_Map<float>& m, vector<int>& contour)
write_Healpix_map_to_fits(h, contour_map, planckType<int>());
}
}
void computeMaskPixels(Healpix_Map<float>& m, vector<int>& contour)
{
for (int p = 0; p < m.Npix(); p++)
{
if (m[p]>0)
{
contour.push_back(p);
// This is boundary go to next pixel
}
}
if (DEBUG)
{
Healpix_Map<int> contour_map;
contour_map.SetNside(m.Nside(), RING);
contour_map.fill(0);
for (int p = 0; p < contour.size(); p++)
{
contour_map[contour[p]]=1;
}
fitshandle h;
h.create("!mask_map.fits");
write_Healpix_map_to_fits(h, contour_map, planckType<int>());
}
}

View file

@ -7,5 +7,6 @@
void computeContourPixels(Healpix_Map<float>& map, std::vector<int>& contour);
void computeFilledPixels(Healpix_Map<float>& map, std::vector<int>& contour);
void computeMaskPixels(Healpix_Map<float>& map, std::vector<int>& contour);
#endif

View file

@ -295,10 +295,10 @@ void generateSurfaceMask(generateFromCatalog_info& args ,
int nPart = 100;
// TEST
for (int iDir = 0; iDir < 0; iDir++) {
for (int iFace = 0; iFace < 0; iFace++) {
//for (int iDir = 0; iDir < 3; iDir++) {
//for (int iFace = 0; iFace < 2; iFace++) {
//for (int iDir = 0; iDir < 0; iDir++) {
//for (int iFace = 0; iFace < 0; iFace++) {
for (int iDir = 0; iDir < 3; iDir++) {
for (int iFace = 0; iFace < 2; iFace++) {
int iy = (iDir + 1) % 3;
int iz = (iDir + 2) % 3;
@ -483,6 +483,7 @@ void saveForZobov(ParticleData& pdata, const string& fname, const string& paramn
//delete[] expansion_fac;
/*
FILE *infoFile = fopen("sample_info.txt", "w");
fprintf(infoFile, "x_min = %f\n", -Lmax/100.);
fprintf(infoFile, "x_max = %f\n", Lmax/100.);
@ -493,7 +494,7 @@ void saveForZobov(ParticleData& pdata, const string& fname, const string& paramn
fprintf(infoFile, "mask_index = %d\n", pdata.mask_index);
fprintf(infoFile, "total_particles = %d\n", pdata.pos.size());
fclose(infoFile);
*/
}
@ -545,6 +546,7 @@ int main(int argc, char **argv)
mask.Import(o_mask);
computeContourPixels(mask,pixel_list);
computeMaskPixels(mask,full_mask_list);
// We compute a cube holding all the galaxies + the survey surface mask

View file

@ -505,6 +505,7 @@ void makeBox(SimuData *simu, double *efac, SimuData *&boxed, generateMock_info&
delete[] expansion_fac;
/*
FILE *fp = fopen("sample_info.txt", "w");
fprintf(fp, "x_min = %f\n", ranges[0][0]);
fprintf(fp, "x_max = %f\n", ranges[0][1]);
@ -515,6 +516,7 @@ void makeBox(SimuData *simu, double *efac, SimuData *&boxed, generateMock_info&
fprintf(fp, "mask_index = -1\n");
fprintf(fp, "total_particles = %d\n", boxed->NumPart);
fclose(fp);
*/
}
void makeBoxFromParameter(SimuData *simu, double *efac, SimuData* &boxed, generateMock_info& args_info)