Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into float_internals
  • Loading branch information
scottransom committed Oct 10, 2012
2 parents 1386495 + 2928e25 commit c059e29
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion include/database.h
@@ -1,5 +1,5 @@
/* Number of entries in PSR database */
#define NP 2000
#define NP 3000
#define NBP 200

/* This is a structure that contains the "normal" information in the database */
Expand Down
19 changes: 8 additions & 11 deletions lib/python/parfile.py
Expand Up @@ -132,17 +132,14 @@ def __init__(self, parfilenm):
f, fd, = pu.p_to_f(self.P0, self.P1)
setattr(self, 'F0_ERR', self.P0_ERR/(self.P0*self.P0))
setattr(self, 'F1', fd)
if hasattr(self, 'F0_ERR'):
if hasattr(self, 'F1_ERR'):
p, perr, pd, pderr = pu.pferrs(self.F0, self.F0_ERR,
self.F1, self.F1_ERR)
setattr(self, 'P0_ERR', perr)
setattr(self, 'P1', pd)
setattr(self, 'P1_ERR', pderr)
else:
p, pd, = pu.p_to_f(self.F0, self.F1)
setattr(self, 'P0_ERR', self.F0_ERR/(self.F0*self.F0))
setattr(self, 'P1', pd)
if (hasattr(self, 'F0_ERR') and hasattr(self, 'F1_ERR')):
p, perr, pd, pderr = pu.pferrs(self.F0, self.F0_ERR,
self.F1, self.F1_ERR)
setattr(self, 'P0_ERR', perr)
setattr(self, 'P1', pd)
setattr(self, 'P1_ERR', pderr)
elif (hasattr(self, 'F0') and hasattr(self, 'F0_ERR')):
setattr(self, 'P0_ERR', self.F0_ERR/(self.F0*self.F0))
if hasattr(self, 'EPS1') and hasattr(self, 'EPS2'):
ecc = math.sqrt(self.EPS1 * self.EPS1 + self.EPS2 * self.EPS2)
omega = math.atan2(self.EPS1, self.EPS2)
Expand Down
5 changes: 5 additions & 0 deletions src/database.c
Expand Up @@ -27,6 +27,11 @@ int read_database(void)
database = chkfopen(databasenm, "rb");

while (chkfread(&pdata, sizeof(psrdata), 1, database)) {
if (np >= NP) {
printf("NP value set to small (%d) in $PRESTO/include/database.h\n", NP);
printf("Please increase it and recompile\n");
exit(-1);
}
strncpy(pulsardata[np].jname, pdata.jname, 13);
strncpy(pulsardata[np].bname, pdata.bname, 9);
strncpy(pulsardata[np].alias, pdata.alias, 10);
Expand Down

0 comments on commit c059e29

Please sign in to comment.