Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
lmdiazangulo committed Jan 1, 2025
1 parent 6ad160d commit 59bbc96
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src_pyWrapper/pyWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ def __init__(self, probe_filename):
self.domainType = self._getDomainTypeFromFilename(probe_filename)

tag = self._getTagFromFilename(probe_filename)
if tag not in Probe.MOVIE_TAGS:
self.df = pd.read_csv(self.filename, sep='\\s+')

position_str = self._getPositionStrFromFilename(probe_filename)
if tag in Probe.CURRENT_PROBE_TAGS:
self.type = 'wire'
self.cell = self._positionStrToCell(position_str)
self.segment = int(position_str.split('_s')[1])
self.df = pd.read_csv(self.filename, sep='\s+')
if self.domainType == 'time':
self.df = self.df.rename(columns={\
't': 'time',
Expand All @@ -54,7 +56,6 @@ def __init__(self, probe_filename):
self.cell = self._positionStrToCell(position_str)
self.field = tag[1]
self.direction = tag[2]
self.df = pd.read_csv(self.filename, sep='\s+')
if self.domainType == 'time':
self.df = self.df.rename(columns = {
't': 'time',
Expand All @@ -66,7 +67,6 @@ def __init__(self, probe_filename):
init_str, end_str = position_str.split('__')
self.cell_init = self._positionStrToCell(init_str)
self.cell_end = self._positionStrToCell(end_str)
self.df = pd.read_csv(self.filename, sep='\s+')
elif tag in Probe.MOVIE_TAGS:
self.type = 'movie'
init_str, end_str = position_str.split('__')
Expand All @@ -75,7 +75,6 @@ def __init__(self, probe_filename):
elif tag in Probe.MTLN_PROBE_TAGS:
self.type ='mtln'
self.cell = self._positionStrToCell(position_str)
self.df = pd.read_csv(self.filename, sep='\s+')
else:
raise ValueError("Unable to determine probe name or type for a probe with name:" + basename)

Expand Down

0 comments on commit 59bbc96

Please sign in to comment.