Permalink
Browse files

Merge branch 'master' into float_internals

  • Loading branch information...
2 parents 1386495 + 2928e25 commit c059e297cd82cbf0a94f9148dd1b87625805e85e @scottransom committed Oct 10, 2012
Showing with 14 additions and 12 deletions.
  1. +1 −1 include/database.h
  2. +8 −11 lib/python/parfile.py
  3. +5 −0 src/database.c
View
@@ -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 */
View
@@ -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)
View
@@ -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);

0 comments on commit c059e29

Please sign in to comment.