mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 23:31:12 +00:00
fixed bugs associated with saving RA and Dec
This commit is contained in:
parent
10dfe29a26
commit
90964d2be3
6 changed files with 23 additions and 25 deletions
|
@ -27,6 +27,7 @@ struct NYU_Data
|
||||||
double cz;
|
double cz;
|
||||||
double fgotten;
|
double fgotten;
|
||||||
double phi_z;
|
double phi_z;
|
||||||
|
double uniqueID;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Position
|
struct Position
|
||||||
|
@ -41,6 +42,7 @@ struct ParticleData
|
||||||
vector<double> dec;
|
vector<double> dec;
|
||||||
vector<double> redshift;
|
vector<double> redshift;
|
||||||
vector<double> catalogID;
|
vector<double> catalogID;
|
||||||
|
vector<double> uniqueID;
|
||||||
int id_mask;
|
int id_mask;
|
||||||
// PMS
|
// PMS
|
||||||
int mask_index;
|
int mask_index;
|
||||||
|
@ -408,6 +410,7 @@ void saveForZobov(ParticleData& pdata, const string& fname, const string& paramn
|
||||||
UnformattedWrite f(fname);
|
UnformattedWrite f(fname);
|
||||||
static const char axis[] = { 'X', 'Y', 'Z' };
|
static const char axis[] = { 'X', 'Y', 'Z' };
|
||||||
double Lmax = pdata.Lmax;
|
double Lmax = pdata.Lmax;
|
||||||
|
double r2d = 180./M_PI;
|
||||||
|
|
||||||
f.beginCheckpoint();
|
f.beginCheckpoint();
|
||||||
f.writeInt32(pdata.pos.size());
|
f.writeInt32(pdata.pos.size());
|
||||||
|
@ -428,33 +431,31 @@ void saveForZobov(ParticleData& pdata, const string& fname, const string& paramn
|
||||||
cout << format("Writing RA...") << endl;
|
cout << format("Writing RA...") << endl;
|
||||||
f.beginCheckpoint();
|
f.beginCheckpoint();
|
||||||
for (uint32_t i = 0; i < pdata.pos.size(); i++) {
|
for (uint32_t i = 0; i < pdata.pos.size(); i++) {
|
||||||
f.writeReal32(pdata.pos[i].ra);
|
f.writeReal32(pdata.ra[i]*r2d);
|
||||||
}
|
}
|
||||||
f.endCheckpoint();
|
f.endCheckpoint();
|
||||||
|
|
||||||
cout << format("Writing Dec...") << endl;
|
cout << format("Writing Dec...") << endl;
|
||||||
f.beginCheckpoint();
|
f.beginCheckpoint();
|
||||||
for (uint32_t i = 0; i < pdata.pos.size(); i++) {
|
for (uint32_t i = 0; i < pdata.pos.size(); i++) {
|
||||||
f.writeReal32(pdata.pos[i].Dec);
|
f.writeReal32(pdata.dec[i]*r2d);
|
||||||
}
|
}
|
||||||
f.endCheckpoint();
|
f.endCheckpoint();
|
||||||
|
|
||||||
cout << format("Writing Redshift...") << endl;
|
cout << format("Writing Redshift...") << endl;
|
||||||
f.beginCheckpoint();
|
f.beginCheckpoint();
|
||||||
for (uint32_t i = 0; i < pdata.pos.size(); i++) {
|
for (uint32_t i = 0; i < pdata.pos.size(); i++) {
|
||||||
f.writeReal32(pdata.pos[i].cz);
|
f.writeReal32(pdata.redshift[i]);
|
||||||
}
|
}
|
||||||
f.endCheckpoint();
|
f.endCheckpoint();
|
||||||
|
|
||||||
cout << format("Writing Unique ID...") << endl;
|
cout << format("Writing Unique ID...") << endl;
|
||||||
f.beginCheckpoint();
|
f.beginCheckpoint();
|
||||||
for (uint32_t i = 0; i < pdata.pos.size(); i++) {
|
for (uint32_t i = 0; i < pdata.pos.size(); i++) {
|
||||||
f.writeReal32(pdata.pos[i].uniqueID);
|
f.writeReal32(pdata.uniqueID[i]);
|
||||||
}
|
}
|
||||||
f.endCheckpoint();
|
f.endCheckpoint();
|
||||||
|
|
||||||
NcFile fp(paramname.c_str(), NcFile::Replace);
|
|
||||||
NcFile fp(paramname.c_str(), NcFile::Replace);
|
|
||||||
NcFile fp(paramname.c_str(), NcFile::Replace);
|
NcFile fp(paramname.c_str(), NcFile::Replace);
|
||||||
|
|
||||||
fp.add_att("range_x_min", -Lmax/100.);
|
fp.add_att("range_x_min", -Lmax/100.);
|
||||||
|
|
|
@ -178,16 +178,16 @@ SimuData *doLoadMultidark(const char *multidarkname)
|
||||||
for (int k = 0; k < 3; k++)
|
for (int k = 0; k < 3; k++)
|
||||||
outd->Pos[k] = new float[outd->NumPart];
|
outd->Pos[k] = new float[outd->NumPart];
|
||||||
outd->Vel[2] = new float[outd->NumPart];
|
outd->Vel[2] = new float[outd->NumPart];
|
||||||
outd->uniqueID = new float[outd->NumPart];
|
outd->Id = new int[outd->NumPart];
|
||||||
|
|
||||||
cout << "loading multidark particles" << endl;
|
cout << "loading multidark particles" << endl;
|
||||||
actualNumPart = 0;
|
actualNumPart = 0;
|
||||||
for (int i = 0; i < outd->NumPart; i++) {
|
for (int i = 0; i < outd->NumPart; i++) {
|
||||||
fscanf(fp, "%d %f %f %f %f\n", &outd->uniqueID[i],
|
fscanf(fp, "%d %d %f %f %f\n", &outd->Id[i],
|
||||||
&outd->Pos[0][i], &outd->Pos[1][i],
|
&outd->Pos[0][i], &outd->Pos[1][i],
|
||||||
&outd->Pos[2][i], &outd->Vel[2][i]);
|
&outd->Pos[2][i], &outd->Vel[2][i]);
|
||||||
|
|
||||||
if (outd->uniqueID[i] == -99 &&
|
if (outd->Id[i] == -99 &&
|
||||||
outd->Pos[0][i] == -99 && outd->Pos[1][i] == -99 &&
|
outd->Pos[0][i] == -99 && outd->Pos[1][i] == -99 &&
|
||||||
outd->Pos[2][i] == -99 && outd->Vel[2][i] == -99) {
|
outd->Pos[2][i] == -99 && outd->Vel[2][i] == -99) {
|
||||||
break;
|
break;
|
||||||
|
@ -368,7 +368,7 @@ void generateOutput(SimuData *data, int axis,
|
||||||
f.beginCheckpoint();
|
f.beginCheckpoint();
|
||||||
for (uint32_t i = 0; i < data->NumPart; i++)
|
for (uint32_t i = 0; i < data->NumPart; i++)
|
||||||
{
|
{
|
||||||
f.writeReal32(data->uniqueID[i]);
|
f.writeReal32(data->Id[i]);
|
||||||
}
|
}
|
||||||
f.endCheckpoint();
|
f.endCheckpoint();
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ void generateOutput(SimuData *data, int axis,
|
||||||
f.beginCheckpoint();
|
f.beginCheckpoint();
|
||||||
for (uint32_t i = 0; i < data->NumPart; i++)
|
for (uint32_t i = 0; i < data->NumPart; i++)
|
||||||
{
|
{
|
||||||
f.writeReal32(data->uniqueID[i]);
|
f.writeReal32(data->Id[i]);
|
||||||
}
|
}
|
||||||
f.endCheckpoint();
|
f.endCheckpoint();
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ void generateOutput(SimuData *data, int axis,
|
||||||
f.beginCheckpoint();
|
f.beginCheckpoint();
|
||||||
for (uint32_t i = 0; i < data->NumPart; i++)
|
for (uint32_t i = 0; i < data->NumPart; i++)
|
||||||
{
|
{
|
||||||
f.writeReal32(data->uniqueID[i]);
|
f.writeReal32(data->Id[i]);
|
||||||
}
|
}
|
||||||
f.endCheckpoint();
|
f.endCheckpoint();
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ void generateOutput(SimuData *data, int axis,
|
||||||
f.beginCheckpoint();
|
f.beginCheckpoint();
|
||||||
for (uint32_t i = 0; i < data->NumPart; i++)
|
for (uint32_t i = 0; i < data->NumPart; i++)
|
||||||
{
|
{
|
||||||
f.writeReal32(data->uniqueID[i]);
|
f.writeReal32(data->Id[i]);
|
||||||
}
|
}
|
||||||
f.endCheckpoint();
|
f.endCheckpoint();
|
||||||
|
|
||||||
|
|
|
@ -538,8 +538,7 @@ int main(int argc, char **argv) {
|
||||||
voids[iVoid].redshift,
|
voids[iVoid].redshift,
|
||||||
4./3.*M_PI*pow(voids[iVoid].radius, 3),
|
4./3.*M_PI*pow(voids[iVoid].radius, 3),
|
||||||
voids[iVoid].voidID,
|
voids[iVoid].voidID,
|
||||||
voids[iVoid].densCon,
|
voids[iVoid].densCon);
|
||||||
);
|
|
||||||
|
|
||||||
fprintf(fpSkyPositions, "%.2f %.2f %.5f %.2f %d\n",
|
fprintf(fpSkyPositions, "%.2f %.2f %.5f %.2f %d\n",
|
||||||
atan((voids[iVoid].barycenter[1]-boxLen[1]/2.)/(voids[iVoid].barycenter[0]-boxLen[0]/2.)) * 180/M_PI + 180,
|
atan((voids[iVoid].barycenter[1]-boxLen[1]/2.)/(voids[iVoid].barycenter[0]-boxLen[0]/2.)) * 180/M_PI + 180,
|
||||||
|
@ -591,6 +590,6 @@ int main(int argc, char **argv) {
|
||||||
clock1 = clock();
|
clock1 = clock();
|
||||||
|
|
||||||
|
|
||||||
printf("Done!");
|
printf("Done!\n");
|
||||||
return 0;
|
return 0;
|
||||||
} // end main
|
} // end main
|
||||||
|
|
2
external/cosmotool/src/loadSimu.hpp
vendored
2
external/cosmotool/src/loadSimu.hpp
vendored
|
@ -41,6 +41,8 @@ namespace CosmoTool
|
||||||
delete[] type;
|
delete[] type;
|
||||||
if (Id)
|
if (Id)
|
||||||
delete[] Id;
|
delete[] Id;
|
||||||
|
if (uniqueID)
|
||||||
|
delete[] uniqueID;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -62,11 +62,11 @@ for sample in dataSampleList:
|
||||||
os.makedirs(zobovDir)
|
os.makedirs(zobovDir)
|
||||||
|
|
||||||
# save this sample's information
|
# save this sample's information
|
||||||
with open(zobovDir+"/sample_info.dat", 'wb') as output:
|
with open(zobovDir+"/sample_info.dat", 'w') as output:
|
||||||
pickle.dump(sample, output, pickle.HIGHEST_PROTOCOL)
|
pickle.dump(sample, output, pickle.HIGHEST_PROTOCOL)
|
||||||
fp = open(zobovDir+"/sample_info.txt", 'w')
|
#fp = open(zobovDir+"/sample_info.txt", 'w')
|
||||||
fp.write("Redshift range: %f - %f" %(sample.zBoundary[0], sample.zBoundary[1])
|
#fp.write("Redshift range: %f - %f" %(sample.zBoundary[0], sample.zBoundary[1])
|
||||||
fp.close()
|
#fp.close()
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
if (startCatalogStage <= 1) and (endCatalogStage >= 1) and not sample.isCombo:
|
if (startCatalogStage <= 1) and (endCatalogStage >= 1) and not sample.isCombo:
|
||||||
|
|
|
@ -297,12 +297,8 @@ def launchPrune(sample, binPath, thisDataPortion=None,
|
||||||
cmd += " >& " + logFile
|
cmd += " >& " + logFile
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
if jobSuccessful(logFile, "NetCDF: Not a valid ID\n") or \
|
if jobSuccessful(logFile, "NetCDF: Not a valid ID\n") or \
|
||||||
jobSuccessful(logFile, "Done!"):
|
jobSuccessful(logFile, "Done!\n"):
|
||||||
=======
|
|
||||||
if jobSuccessful(logFile, "NetCDF: Not a valid ID\n") or jobSuccessful(logFile, "Done!\n"):
|
|
||||||
>>>>>>> 3d6fae9882fde44515a59e1144646d77bbd1a124
|
|
||||||
print "done"
|
print "done"
|
||||||
else:
|
else:
|
||||||
print "FAILED!"
|
print "FAILED!"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue