Question
#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()
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, inStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started