homework | 作业thread | quiz | Python | 代做assignment | 代做lab – Homework Assignment 4

Homework Assignment 4

homework | 作业thread | quiz | Python | 代做assignment | 代做lab – 本题是一个利用thread进行练习的代做, 对thread的流程进行训练解析, 涵盖了thread/Python等方面, 这个项目是lab代写的代写题目

多线程代写 代写多线程 multi-threading代写

This assignment primarily concerns the material in notebooks 8, 12, 13 and the associated labs.

Save your completed homework file in your repository, as mp248/Assignment.4/Assignment.4.ipynb.

Ensure you do not copy any of the weather data (.csv files) or crime data (the big .jeojson file) into your personal repo. If such files are discovered in your repo you will lose one point on this assignment.

The pre-grading script will start grading by Saturday March 23rd, uploading feedback to Task 8. See the relevant CourseSpaces thread for details on what the pre-grading script is looking for.

In your labs March 25th–29th we will ask you to move all the code you need from notebooks 8, 12, 13 and the relevant labs into a library that you will import into this notebook, i.e. we ask you to minimize (in this notebook) the amount of recycled code from class and previous labs, to make your work easier to grade.

P1: Weather data

Load the common weather data for the four cities as we did in Lecture Notebook 12.

a) For each city, and each month, compute the average of: daily max, min and mean temperatures for that month. In more concrete detail: for Edmonton January max temperatures, you would take the average of all the maximum temperatures for every day in January, for all years in which we have data, for the city of Edmonton. You would do the same for every month, and all three temperature readings (daily max, min, mean). Output your answer as four numpy matrices.

b) For every city, and every weather reading (daily max, min, mean), find the weather record where that daily temperature recording differs from the monthly average by the largest amount. i.e. your answer to part (b) will consist of 12 weather records. Please format your answer so that you have your 12=43* answers on one line each. For example, one line would be:

Edmonton, Mean Temp (C), avg: AVG, Temp: TMP, Dev: DEV, Date: YYYY-MM-DD

This would be the answer for Edmonton’s Mean temperature readings. YYYY-MM-DD would be the date of the maximum deviation from the average of all temperatures in the month MM. TMP is the temperature reading on that day (in this case, the daily mean temp). AVG is the average of the temperature readings for month MM. DEV is the difference between TMP and AVG, i.e. DEV = TMP-AVG.

12 3

In [ ]:

In [ ]:

In [ ]:

P2: Crime data

Which crimes (use parent_incident_type ) are more common in proximitiy to The Bay Centre, and which are more common far from the Bay Centre? Start your analysis with a histogram using the distance function as in lab 13.b problem 3. I suggest starting your analysis using bin endpoints that are integer multiples of .

Please put any further analysis (by crime) in a text field in your plot. After your histograms, list the parent_incident_types by their from most commonly to least commonly happening in the vicinity of the Bay Centre.

500 m

In [ ]:

In [ ]:

In [ ]:

In [ ]:

In [ ]:

P3: Crime and Weather data

This problem asks you to compare the Victoria PD Traffic Collision data, on typical days vs. on days when IT snows , also accidents near hills.

(a) For how many days do we have both crime data (from Notebook 13 ) and weather data (see Notebook 8 ) for Victoria? Comment: Regarding Notebook 8, please use the dates from the coml variable. For how many of our crime records do we have weather data?

(b) Compute the average number of COLLISION records (under Traffic — see the ctree variable from Notebook 13) per day (on all days) vs. the average number on days where it snowed.

(c) Repeat (b) but where you restrict yourself to car crashes near major hills in town. Let’s say the major hills are (1) near Trafalgar Park, (2) the corner of Burdett and Blanshard, and (3) one hill of your choice. Find the GPS coordinates of these locations using Google Maps, and restrict yourself to accidents within a 200m radius of those coordinates.

In [ ]:

In [ ]:

In [ ]:

In [ ]:

In [ ]:

In [ ]:

P4: Quiz.3 revisited

Let’s revisit quiz 3. Write a Python function

collisionPlot(va,vb,ma,mb)

that not only counts all the collisions between the billiards and the wall, but it also plots them. i.e. the output of collisionPlot will be a matplotlib figure similar to

i.e. it will show the paths of the billiards. Thus to solve this problem you will need to compute both the collision times and their locations; not just the velocity sequence.

Include the plots for va=0, vb=-1, ma=1, mb=10, 100. Set your figsize to (8,8) so that the plots are reasonably-large.

In [ ]:

In [ ]:

In [ ]:

In [ ]:

In [ ]: