Skip to content

Commit

Permalink
Fixed issue #10
Browse files Browse the repository at this point in the history
  • Loading branch information
seimit committed Nov 2, 2021
1 parent 6ac66d2 commit eec9c26
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 26 deletions.
11 changes: 7 additions & 4 deletions Metis/tools/STDFHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,13 @@ def get_str_field(str_fields, stdf_record, rec_name):
for field_name in fields:

field_type = stdf_record.fields[field_name]['Type']
if field_type.startswith('C'):
full_field_name = rec_name+'.'+field_name
if full_field_name not in str_fields:
str_fields.append(full_field_name)
if field_type.startswith('C') or \
field_type.startswith('B*') or \
field_type.startswith('x'):

full_field_name = rec_name+'.'+field_name
if full_field_name not in str_fields:
str_fields.append(full_field_name)

def get_stdf_record(ver, byteorder, rec_len, rec_typ, rec_sub, rec):

Expand Down
8 changes: 1 addition & 7 deletions Metis/tools/stdf2csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,7 @@ def stdf2csv(self, stdr_record, output_folder, part_num):
#Converting the list as string
if type(value) == list:
v = str(value)
v = v.replace(',','')
v = v.replace('[','')
v = v.replace(']','')
value = v.replace('\'','')
value = '"' + value + '"'
s += value.replace(' ', '')
s += ','
s += '"' + v + '",'
continue
else:
value = str(value)
Expand Down
17 changes: 6 additions & 11 deletions Metis/tools/stdf2ph5.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os.path
import pandas as pd
from tqdm import tqdm
from ast import literal_eval

import Semi_ATE.STDF.FAR as FAR
import Semi_ATE.STDF.ATR as ATR
Expand All @@ -31,7 +32,6 @@
import Semi_ATE.STDF.EPS as EPS
import Semi_ATE.STDF.GDR as GDR
import Semi_ATE.STDF.DTR as DTR

try:
from .STDFHelper import STDFHelper
from .HDF5Helper import HDF5Helper
Expand Down Expand Up @@ -412,12 +412,13 @@ def stdf2pandas(self, stdf_file, output_file):
dataset_path = SHP.STDF_RECORDS_DIR+'/'+file_name+'/'

for record_name in frames.keys():

fn = record_name + ".csv"
if os.path.isfile(fn):
data = pd.read_csv(fn)
data_loc = dataset_path+record_name
# Sets string type for STDF fields with C*n type after CSV import
# Sets string type for STDF fields with C*n/B*n/kxTYPE type
# after CSV import
fields = data.keys()
for field in fields:
if field in str_fields:
Expand Down Expand Up @@ -511,16 +512,9 @@ def stdf2csv(self, stdr_record, part_index, bps_seq_name, wir_start_t):
column_name = record_name+"."+field_name
value = stdr_record.fields[field_name]['Value']
# Converting the list as string
# like ['1', '1', '0', '0', '1', '1'] -> 110011
if type(value) == list:
v = str(value)
v = v.replace(',','')
v = v.replace('[','')
v = v.replace(']','')
value = v.replace('\'','')
value = '"' + value + '"'
s += value.replace(' ', '')
s += ','
s += '"' + v + '",'
continue
else:
value = str(value)
Expand Down Expand Up @@ -574,6 +568,7 @@ def main():
debug = False
else:
debug = True


stdf2hdf52pandas = SHP(debug)
for input_file in args.input:
Expand Down
12 changes: 8 additions & 4 deletions tests/test_stdf_convert.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
# -*- coding: utf-8 -*-

from Metis.tools import SHP
from Metis.tools import SCC

import time
import h5py
import os
import os.path

import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))


import Semi_ATE.STDF.FAR as FAR
import Semi_ATE.STDF.ATR as ATR
import Semi_ATE.STDF.WIR as WIR
import Semi_ATE.STDF.MIR as MIR
import Semi_ATE.STDF.PCR as PCR
import Semi_ATE.STDF.MRR as MRR

from Metis.tools.stdf2ph5 import SHP
from Metis.tools.stdf2csv import SCC


# Tests are not finished yet. Only basic tests were written, not real ones.

def test_SHP():
Expand Down

0 comments on commit eec9c26

Please sign in to comment.