Question: Problem 1 ( 2 0 marks ) : Reading, plotting, and analysing data from a file. Read in the contents of the file 'rev 2

Problem 1(20 marks): Reading, plotting, and analysing data from a file.
Read in the contents of the file 'rev26_27.dat' into a RecArray. This is a data file containing results from a spacecraft called Cassini: the magnetometer measurements from two orbits around Saturn in 2007. The columns are day-of-year since 2004, and three field components in spherical polar coordinates \(\left(B_{r}, B_{\theta}, B_{\varphi}\right)\). Make the following plot:
- Plot \( B_{r}\) versus day of year since 2004 with cyan dots.
- Limit the time (date) axis to between 935 to 955 days, and the \( y \) axis to between -3.5 to 6.5
- Label the axes appropriately and add a title and a legend.
- Add a dotted green horizontal line at \( B_{r}=0\).
- Plot a quadratic regression (line of best fit with a polynomial of second order) in blue, and print the coefficients of the fit.
- Introduce an array of days from 935 to 955(e.g.,\(935,936,\ldots 954\)). For each of the days, calculate the daily mean of \( B_{r}\) and also its daily maximum. Call these arrays Brmean and Brmax, respectively. Use array slicing and Boolean True/False to select the data for this.
- Plot Brmean and Brmax versus day of the year on the same panel as the data above with red crosses and a blue dosh-dat line, respectively, labelling the data appropriately.
- Calculate the mean of Brmax and print it to the third significant digit using the format method.
Problem 1 ( 2 0 marks ) : Reading, plotting, and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!