Take time to play around with different ways to represent

Assignment Help Computer Engineering
Reference no: EM132217413

I have written the code for this problem, which is just graphing x and y values of an input file. However I am getting error messages from the terminal.

The error message says:

Traceback (most recent call last):

File "plot.py", line 17, in

fourth = (parts[1])

IndexError: list index out of range"

Code:

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import argparse

parser = argparse.ArgumentParser ()
parser.add_argument('--input', required = True, help="The name of the data file containing sample polynomial data")
arguments = parser.parse_args()

x_values = []
y_values = []

with open(arguments.input) as input_file:
for line in input_file:
parts = line.split(',')
third = (parts[0])
fourth = (parts[1])
x_values.append(third)
y_values.append(fourth)

print x_values
print len(x_values[0:-1])
lists = [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10]
months = lists
print months

plt.xlabel('Time (sec)')
plt.ylabel('Signal Strength')
plt.title('Signal Strength vs. Time for Relative Activation Energies')
plt.plot(x, y, line_width=.5)
plt.xticks(months)
plt.plot(x_values,y_values, 'ro')
plt.savefig("Data.png")

Assignment 1:

1. Use argparse to read an input filename from the command line (e.g. myawesomeprogram.py inputfile). If I leave off the command line argument I should get a helpful error message.

2. Read in that file. Use sample_polynomial_data.training.xy which is in the Simple_Fitting_Data directory.

3. Use pyplot (within matplotlib) to plot the data complete with a descriptive title, axis titles, etc. Take time to play around with different ways to represent the data (lines, dots, triangles, different colors). For the axes, assume that the x axis is time in seconds and the y axis is some generic signal strength.

(Be sure that your python program and plot have names that make sense. For instance, your name and something about assignment 1 would seem like good choices.)

ng Kymistry/Simple Fi ting Data/Assign is python plot .py input sample polynomial da ta. traini Traceback most recent call last): File "plot.py", ine 17, in <="" span="">

Reference no: EM132217413

Questions Cloud

Identify the case you will be using for the final project : In order to provide the appropriate intervention, social workers first need to have conducted a thorough assessment. Having a comprehensive understanding.
Display student data including students average score : Display student data including students average score and letter grade. Prompt the user for a valid class size.
What percentage of time is the server idle : The average service time at the CSUS Financial Aid Office is 5.9 minutes. what percentage of time is the server idle?
Complete until goals are set and performance is measured : An advertising campaign plan is never complete until goals are set and performance is measured.
Take time to play around with different ways to represent : Take time to play around with different ways to represent the data (lines, dots, triangles, different colors).
Calculator that prompts the user for two numbers : In this lab, you complete a partially written C++ program that includes a function that returns a value.
What factors lead to project management success : ‘what factors lead to project management success What factors lead to a successful project?'' and ‘‘what factors are key to the specifics of the project
How to improve the processes in the given area : One of your clients, Gravina Gravel, is interested in improving the quality of its financial reporting and has asked for your advice regarding how to improve.
What is the expected number of customers in the system : Drop-in customers arrive at the Department of Motor Vehicles at a rate of 19.2 per hour. What is the expected number of customers in the system?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd