temoTxt / Stress_Strain_Analysis_Tools

0 stars 0 forks source link

Variables to Provide Key #4

Closed directorfury192 closed 5 years ago

directorfury192 commented 5 years ago

Please provide a Type Specimen Key that provides the following information, read from the filename which will include typei, typeiv, or _d3039:

Specimen Area Gage Length Type I 41.6 50 Type IV 19.2 25 D3039 82.5 180

directorfury192 commented 5 years ago

This folder has python scripts i have written that could provide usable starting points to do this. Let me know what you think. https://onedrive.live.com/?id=C7858221CE2FBE53%21273629&cid=C7858221CE2FBE53

directorfury192 commented 5 years ago

@tjm5114 so i think what we need to do here is in the data header scrub file, BEFORE we scrub the header information we need to read it. Something like:

open(filename) as temps: if ('Data Header') in line: nb=line.split() specimen_type=nb[#] layer_thickness=nb[#] infill=nb[#]

Then scrub the header data throughout the file. Now we can use the following:

if specimen_type = str('typei') gage_length = 50 area = 41.6 elseif specimen_type=str(typeiv) gage_length=25 area=19.2 elseif specimen_type=str(d3039) gage_length = 180 area = 82.5

Where the nb[#] corresponds to the point in the line where we have the type. Also, @Nsearchof I want to change what we put in the data header. The underscores there make the line split function difficult. I want to be able to pull the Specimen Type, Layer Thickness, and Infill out and make those separate variables. I think we can use them for data parsing.

Thoughts?

Nsearchof commented 5 years ago

Sounds good, I have a few questions for you both for clarity.

Sent from my iPhone

On Apr 19, 2019, at 10:05 AM, directorfury192 notifications@github.com wrote:

@tjm5114 so i think what we need to do here is in the data header scrub file, BEFORE we scrub the header information we need to read it. Something like:

open(filename) as temps: if ('Data Header') in line: nb=line.split() specimen_type=nb[#] layer_thickness=nb[#] infill=nb[#]

Then scrub the header data throughout the file. Now we can use the following:

if specimen_type = str('typei') gage_length = 50 area = 41.6 elseif specimen_type=str(typeiv) gage_length=25 area=19.2 elseif specimen_type=str(d3039) gage_length = 180 area = 82.5

Where the nb[#] corresponds to the point in the line where we have the type. Also, @Nsearchof I want to change what we put in the data header. The underscores there make the line split function difficult. I want to be able to pull the Specimen Type, Layer Thickness, and Infill out and make those separate variables. I think we can use them for data parsing.

Thoughts?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

directorfury192 commented 5 years ago

Only moving forward should the data header change. I'm thinking my tests. Not the kiddies. Unless they want to do manual changes to the data header.

I am still thinking about what the header should be. I'm thinking if we had spaces in lieu of underscores that would make splitting the line easier.

Both maybe. Does the fatigue data need unique constants based on the specimen type? If you need the unique gage length and x-sectional area then yes. It's important.

On Sun, Apr 21, 2019, 10:48 PM Nsearchof notifications@github.com wrote:

Sounds good, I have a few questions for you both for clarity.

  • Is the data header change for the completed tests or for those moving forward. (Or both) (Since you and the kiddies have more testing, I can update that in the system so that it’s good moving forward) -what is the preferred data header format? -will the file renaming for existing files be automated? Or manually done to facilitate the data parsing?
  • Is this change something we are applying to both tensile and fatigue data collection and code? Or is it more beneficial for one than the other? (So that I can rename my fatigue data as well)

Sent from my iPhone

On Apr 19, 2019, at 10:05 AM, directorfury192 notifications@github.com wrote:

@tjm5114 so i think what we need to do here is in the data header scrub file, BEFORE we scrub the header information we need to read it. Something like:

open(filename) as temps: if ('Data Header') in line: nb=line.split() specimen_type=nb[#] layer_thickness=nb[#] infill=nb[#]

Then scrub the header data throughout the file. Now we can use the following:

if specimen_type = str('typei') gage_length = 50 area = 41.6 elseif specimen_type=str(typeiv) gage_length=25 area=19.2 elseif specimen_type=str(d3039) gage_length = 180 area = 82.5

Where the nb[#] corresponds to the point in the line where we have the type. Also, @Nsearchof I want to change what we put in the data header. The underscores there make the line split function difficult. I want to be able to pull the Specimen Type, Layer Thickness, and Infill out and make those separate variables. I think we can use them for data parsing.

Thoughts?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/temoTxt/Stress_Strain_Analysis_Tools/issues/4#issuecomment-485308646, or mute the thread https://github.com/notifications/unsubscribe-auth/AKY7IWI7XV3MNJ7C7F6YKADPRURQ7ANCNFSM4HGELMQQ .

temoTxt commented 5 years ago

@directorfury192 can you just read the file name and parse up it's name to get those parameters and if it's tensile or fatigue? Perhaps coming up with a file name convention would make it easier if you didn't already have one.

directorfury192 commented 5 years ago

Yes I could. But the file name is the same as the data header. It's all one word. I need one part of the file name.

On Mon, Apr 22, 2019, 7:59 AM temoTxt notifications@github.com wrote:

@directorfury192 https://github.com/directorfury192 can you just read the file name and parse up it's name to get those parameters and if it's tensile or fatigue? Perhaps coming up with a file name convention would make it easier if you didn't already have one.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/temoTxt/Stress_Strain_Analysis_Tools/issues/4#issuecomment-485401286, or mute the thread https://github.com/notifications/unsubscribe-auth/AKY7IWLYHJPKBEFVUWT5RODPRWSCBANCNFSM4HGELMQQ .

temoTxt commented 5 years ago

you just use a split string on the underscore(_) and that will return to a list of each word without the underscore.

something like:

split_file_name = filename.split('')

Then you can index each word by split_file_name[0], split_file_name[1], etc.

directorfury192 commented 5 years ago

Ok cool. That makes sense. Didn't realize I could do that. Shouldn't need to change anything then. Will noodle today and report back

On Mon, Apr 22, 2019, 9:21 AM temoTxt notifications@github.com wrote:

you just use a split string on the underscore(_) and that will return to a list of each word without the underscore.

something like:

split_file_name = filename.split('')

Then you can index each word by split_file_name[0], split_file_name[1], etc.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/temoTxt/Stress_Strain_Analysis_Tools/issues/4#issuecomment-485416653, or mute the thread https://github.com/notifications/unsubscribe-auth/AKY7IWLSO3BAO66JFA2DPVLPRW3U7ANCNFSM4HGELMQQ .

directorfury192 commented 5 years ago

Completed. See below:

for i in range(0, 4): layer_infill = ['0.254solid', '0.3302solid', '0.254hd', '0.3302hd'] file_front = 'data/' + str(layer_infill[i])

print(file_front)

for j in range(0,2):
    printer = ['uprint', 'dimension']
    file_middle = file_front + str(printer[j]) + '_'
    # print(file_middle)
    for k in range(0,2):
        type = ['typei', 'typeiv']
        file_back = file_middle + str(type[k])
        for n in range(0, 2):
            raster = ['_4545_', '_090_']
            file_last = file_back + str(raster[n]) + 'r('
            for replicates in range(1, 11):
                file = file_last + str(replicates) + ').dat'
                # print(file)
                split_filename = file.split('_')
                specimen_type = split_filename[3]
                printer = split_filename[2]
                layer = split_filename[0]
                split_layer = layer.split('/')
                layer_thickness = split_layer[1]
                infill = split_filename[1]