Skip to content

Commit

Permalink
debug update_num_rec
Browse files Browse the repository at this point in the history
  • Loading branch information
xumi1993 committed Jul 12, 2024
1 parent 3bee8f6 commit 890d27a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions pytomoatt/src_rec.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ def src_points(self):
def src_points(self, value):
if value is None or isinstance(value, pd.DataFrame):
self._src_points = value
if not self._src_points.empty:
self._src_points = self._src_points.astype(
{
"evla": float,
"evlo": float,
"evdp": float,
"mag": float,
"num_rec": int,
"event_id": str,
"weight": float,
}
)
self._src_points.index.name = "src_index"
else:
raise TypeError("src_points should be in DataFrame")
Expand Down Expand Up @@ -643,9 +655,11 @@ def update_num_rec(self):
"""
self.src_points["num_rec"] = self.rec_points.groupby("src_index").size()
if not self.rec_points_cr.empty:
self.src_points["num_rec"] += self.rec_points_cr.groupby("src_index").size()
num = self.rec_points_cr.groupby("src_index").size()
self.src_points.loc[num.index, "num_rec"] += num
if not self.rec_points_cs.empty:
self.src_points["num_rec"] += self.rec_points_cs.groupby("src_index").size()
num = self.rec_points_cs.groupby("src_index").size()
self.src_points.loc[num.index, "num_rec"] += num

def update(self):
"""
Expand Down

0 comments on commit 890d27a

Please sign in to comment.