Skip to content

Commit

Permalink
rewrite get_taw_result function
Browse files Browse the repository at this point in the history
  • Loading branch information
ikaryss committed Nov 7, 2022
1 parent 41f4658 commit d720ddd
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions pyquac/datatools.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,24 +439,16 @@ def get_result(self, *, imshow: bool = False) -> pd.DataFrame:

def get_raw_result(self):
"""
generates raw Data Frame with columns [x_value, y_value, response]
generates raw Data Frame with columns [x_value, y_value, z_value]
:return: Pandas Data Frame
"""
x = []
y = []
heat = []
y_l = (self.get_result().groupby('x_value')['y_value'].apply(list)).reset_index()
z_l = (self.get_result().groupby('x_value')['z_value'].apply(list))
x_l = z_l.index.to_series(index=np.arange(len(z_l))).to_frame()
z_l = z_l.reset_index()

uniq_x = np.unique(self.raw_frame.x_value.values)

for xx in uniq_x:
y_arr = self.raw_frame[self.raw_frame.x_value == xx].y_value.values
heat_arr = self.raw_frame[self.raw_frame.x_value == xx].heat_value.values

x.append(xx)
y.append(y_arr)
heat.append(heat_arr)

return pd.DataFrame({'x_value': x, 'y_value': y, 'response': heat})
df = x_l.merge(y_l, on='x_value', how='left').merge(z_l, on='x_value', how='left')
return df

@property
def non_njit_result(self):
Expand Down

0 comments on commit d720ddd

Please sign in to comment.