Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#python lists and reading files and plotting # just use the first 500 values from R and T as they are different lengths # i

#python lists and reading files and plotting # just use the first 500 values from R and T as they are different lengths # i get this error for reading list, and the final plot should be a straight line

################################ making R list # find R list at https://pastebin.comX2Y6TVH

import random import numpy f=open('R 77777.txt',"r") lines=f.readlines() R=[] for x in lines: R.append(x.split(' ')[0]) R = [s.rstrip() for s in R] f.close()

################################### making T list # find T list at https://pastebin.com/y2Uby5eF f=open('T 77777.txt',"r") lines=f.readlines() T=[] for x in lines: T.append(x.split(' ')[0]) T = [s.rstrip() for s in T] f.close()

################################## making a list of 1's Z=1 list_of_ones=[] for i in range(len(R)): list_of_ones.append(Z)

################################## each A = 1 - R[i] - T[i] A=[] for i in range(len(R)): A.append(list_of_ones[i] - float(R[i]) - float(T[i])) K=numpy.linspace(0,100,500) print(K) plt.plot(K, A) plt.title("K over A") plt.show()

plt.plot(K, R) plt.title( " R = Y, K = x ") plt.show()

image text in transcribed

RESTART : C:/Users/User/Desktop/photonics/photon test n stuff/copying 7a from pa per 2/test tg 3.py Traceback (most recent cal1 last): reflectivity - Y, wavelengthx File "C:/Users/User/Desktop/photonics/photon test n stuff/copying 7a from pape r 2/test fg 3.py", line 16, in R. append (Xsplit ( ' ' ) [2] ) IndexError: ist index out of range RESTART: C:/Users/User/Desktop/photonics/photon test n stuft/copying 7a from pa per 2/test g 3.py Traceback (most recent call last) File "C:/Users/User/Desktop/photonics/photon test n stuff/copying 7a from pape r 2/test fg 3.", line 39, in A.append (ist of ones-RT1]) TypeError: unsupported operand type (s) to1nt' and "str RESTART: C:/Users/User/Desktop/photonics/photon test n stuff/copying 7a from pa per 2/test fg 3.py Traceback (mo t recent call last): File "C:/Users/User/Desktop/photonics/photon test n stuff/copying 7a from pape r 2/test fg 3.py", line 39, n odule> .append { 11st of ones [1] -float {R[1]) float (T [1])) - - - Valuelrror: coild not convert string to float: 9.17973518E RESTART: C;\Users\User\Desktop\photonics\photon per 2fffgggg 3.py test n stuff\copying 7a from pa problem I) doesnt convert propperly problem 2) bad graphvalue of R doesnt keep ncreasing

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

2. Describe why we form relationships

Answered: 1 week ago

Question

5. Outline the predictable stages of most relationships

Answered: 1 week ago