Importing ONLY numpy, matplotlib.pyplot, csv, and ndarray from numpy. How to do task 5 using the example event (at the b

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Importing ONLY numpy, matplotlib.pyplot, csv, and ndarray from numpy. How to do task 5 using the example event (at the b

Post by answerhappygod »

Importing ONLY numpy, matplotlib.pyplot, csv, and ndarray
from numpy.
How to do task 5 using the example event (at the bottom) and
what the code would be for task 6.
Importing Only Numpy Matplotlib Pyplot Csv And Ndarray From Numpy How To Do Task 5 Using The Example Event At The B 1
Importing Only Numpy Matplotlib Pyplot Csv And Ndarray From Numpy How To Do Task 5 Using The Example Event At The B 1 (281.16 KiB) Viewed 18 times
Importing Only Numpy Matplotlib Pyplot Csv And Ndarray From Numpy How To Do Task 5 Using The Example Event At The B 2
Importing Only Numpy Matplotlib Pyplot Csv And Ndarray From Numpy How To Do Task 5 Using The Example Event At The B 2 (153.31 KiB) Viewed 18 times
Importing Only Numpy Matplotlib Pyplot Csv And Ndarray From Numpy How To Do Task 5 Using The Example Event At The B 3
Importing Only Numpy Matplotlib Pyplot Csv And Ndarray From Numpy How To Do Task 5 Using The Example Event At The B 3 (178.11 KiB) Viewed 18 times
Importing Only Numpy Matplotlib Pyplot Csv And Ndarray From Numpy How To Do Task 5 Using The Example Event At The B 4
Importing Only Numpy Matplotlib Pyplot Csv And Ndarray From Numpy How To Do Task 5 Using The Example Event At The B 4 (221.74 KiB) Viewed 18 times
Example event data (it doesn't look like i can upload the
notepad so just copy it as it is into a notepad):
"TOA5","PythonCustom - Modified Frame","No
Datalogger","0000","No
OS","CPU:UnknownFile.CR1X","0000","Output"
"TIMESTAMP","RECORD","VW_8","VW_20","VW_28","VW_32"
"TS","","","","",""
"","","","","",""
"2021-05-01
08:27:14.530000",1,-0.09423828,-1.75,-0.4482422,-0.1867676
"2021-05-01
08:27:15.030000",2,0.06518555,-1.695312,-0.4379883,-0.25
"2021-05-01
08:27:15.530000",3,0.1206055,-1.712646,-0.529541,-0.2453613
"2021-05-01
08:27:16.030000",4,0.2700195,-1.624268,-0.3664551,-0.1931152
"2021-05-01
08:27:16.530000",5,1.407227,-0.9855957,-0.7604981,-0.4016113
"2021-05-01
08:27:17.030000",6,1.195313,-2.618164,-0.8666992,-0.4272461
"2021-05-01
08:27:17.530000",7,-3.785156,-0.5612793,1.348145,0.3486328
"2021-05-01
08:27:18.030000",8,0.3796387,-0.5004883,-3.111084,-1.47168
"2021-05-01
08:27:18.530000",9,3.225342,-0.3105469,-4.130859,-3.019531
"2021-05-01
08:27:19.030000",10,0.2333984,-0.159668,-1.748047,-1.40625
"2021-05-01
08:27:19.530000",11,0.1472168,-2.77002,-0.2753906,-0.701416
"2021-05-01
08:27:20.030000",12,0.5402832,-1.373291,1.964111,1.036133
"2021-05-01
08:27:20.530000",13,2.373779,-2.523438,2.905273,1.420654
"2021-05-01
08:27:21.030000",14,-0.8862305,-1.040772,4.269043,2.815186
"2021-05-01
08:27:21.530000",15,-2.567383,-0.015625,4.171875,2.679443
"2021-05-01
08:27:22.030000",16,2.189453,0.9423828,0.7041016,-0.9382324
"2021-05-01
08:27:22.530000",17,3.857178,1.157715,-5.594238,-2.548584
"2021-05-01
08:27:23.030000",18,-0.2788086,1.574219,-4.640625,-2.613525
"2021-05-01
08:27:23.530000",19,1.237793,0.9455566,-2.930908,-3.124268
"2021-05-01
08:27:24.030000",20,1.170898,2.002197,-6.20581,-5.014892
"2021-05-01
08:27:24.530000",21,-6.725342,2.858398,-7.529297,-4.155029
"2021-05-01
08:27:25.030000",22,-12.5669,1.855713,-2.935059,-2.156738
"2021-05-01
08:27:25.530000",23,-6.176514,0.6772461,-2.515869,-0.9816894
"2021-05-01
08:27:26.030000",24,-7.978027,-2.117676,1.415527,-1.247559
"2021-05-01
08:27:26.530000",25,-14.62549,-0.6467285,7.305176,4.89917
"2021-05-01
08:27:27.030000",26,-7.277344,-0.5019531,8.432617,6.37793
"2021-05-01
08:27:27.530000",27,0.1887207,-1.12915,3.866943,1.066162
"2021-05-01
08:27:28.030000",28,5.14624,-0.2402344,-0.6323242,-1.177979
"2021-05-01
08:27:28.530000",29,11.15405,-0.03857422,1.7146,-1.246826
"2021-05-01
08:27:29.030000",30,28.11987,-2.098389,-2.153076,-2.362305
"2021-05-01
08:27:29.530000",31,44.68408,1.959717,0.4370117,0.1721191
"2021-05-01
08:27:30.030000",32,64.72436,0.6494141,0.8273926,-1.229492
"2021-05-01
08:27:30.530000",33,66.14258,-0.09545898,0.8669434,-1.517578
"2021-05-01
08:27:31.030000",34,43.29102,1.318848,3.179688,1.265625
"2021-05-01
08:27:31.530000",35,8.798096,0.8347168,3.364502,0.8254394
"2021-05-01
08:27:32.030000",36,-20.7854,3.325928,-2.263428,-0.5754394
"2021-05-01
08:27:32.530000",37,-46.22363,16.36231,-4.273193,-3.596192
"2021-05-01
08:27:33.030000",38,-50.78076,37.70752,-15.36914,-7.457519
"2021-05-01
08:27:33.530000",39,-26.44897,45.57398,-32.39111,-15.55298
"2021-05-01
08:27:34.030000",40,0.5092774,41.67822,-39.17407,-19.87085
"2021-05-01
08:27:34.530000",41,2.85791,25.05835,-41.26148,-19.31348
"2021-05-01
08:27:35.030000",42,0.8088379,5.049316,-34.9939,-16.81274
"2021-05-01
08:27:35.530000",43,-0.6169434,-4.747314,7.808106,1.558838
"2021-05-01
08:27:36.030000",44,4.582275,-5.145752,46.51318,21.69482
"2021-05-01
08:27:36.530000",45,2.59668,0.5178223,70.34106,36.18652
"2021-05-01
08:27:37.030000",46,2.25708,4.793945,68.75952,38.18042
"2021-05-01
08:27:37.530000",47,7.198974,0.673584,53.94336,32.02539
"2021-05-01
08:27:38.030000",48,6.751953,1.885254,27.53955,18.9021
"2021-05-01
08:27:38.530000",49,-0.1184082,-2.796631,20.28979,13.74365
"2021-05-01
08:27:39.030000",50,-0.3967285,-0.3325195,5.148193,3.834228
"2021-05-01
08:27:39.530000",51,0.6550293,1.662598,10.20068,3.507812
"2021-05-01
08:27:40.030000",52,-3.463623,6.891114,13.94873,6.241455
"2021-05-01
08:27:40.530000",53,-1.56665,5.617676,12.33838,4.92334
"2021-05-01
08:27:41.030000",54,1.14209,3.11792,3.042969,-0.940918
"2021-05-01
08:27:41.530000",55,0.6899414,0.2978516,-2.165527,-0.4589844
"2021-05-01
08:27:42.030000",56,0.1328125,2.998535,2.300781,1.23169
"2021-05-01
08:27:42.530000",57,5.643066,3.724365,4.813965,2.037109
"2021-05-01
08:27:43.030000",58,6.347412,2.278076,7.324951,2.790283
"2021-05-01
08:27:43.530000",59,4.49707,-0.2531738,8.459229,4.07666
"2021-05-01
08:27:44.030000",60,2.901855,-0.8395996,7.352783,3.978272
"2021-05-01
08:27:44.530000",61,1.501221,-1.85498,4.874512,2.460449
"2021-05-01
08:27:45.030000",62,-0.7973633,-0.7390137,4.155762,1.286621
"2021-05-01
08:27:45.530000",63,-0.1247559,3.259521,2.073486,0.9333496
"2021-05-01
08:27:46.030000",64,-0.470459,4.736084,0.6943359,0.03686524
"2021-05-01
08:27:46.530000",65,-1.031982,4.513916,-1.28833,-0.2434082
"2021-05-01
08:27:47.030000",66,-2.061523,3.38208,-3.26416,-1.431397
"2021-05-01
08:27:47.530000",67,-0.9521484,3.318359,-5.156006,-2.688477
"2021-05-01
08:27:48.030000",68,-2.23584,4.363281,-3.505615,-1.406494
"2021-05-01
08:27:48.530000",69,-1.753418,3.037109,-1.465576,-0.5803223
"2021-05-01
08:27:49.030000",70,2.394287,1.460205,-0.4396973,-0.6425781
"2021-05-01
08:27:49.530000",71,5.635254,2.504395,1.002441,-0.01904297
"2021-05-01
08:27:50.030000",72,5.111084,3.197021,3.532471,1.223389
"2021-05-01
08:27:50.530000",73,6.530762,3.216309,2.930664,1.477295
"2021-05-01
08:27:51.030000",74,5.337646,1.53125,2.868896,0.909668
"2021-05-01
08:27:51.530000",75,2.718018,3.342529,3.01416,0.8208008
"2021-05-01
08:27:52.030000",76,0.8466797,4.457031,2.424316,0.5043945
"2021-05-01
08:27:52.530000",77,-1.188721,3.440674,2.217285,0.3762207
Background Engineers play a critical role in the management of the assets that they help create, to ensure that they remain functional and safe throughout their design life. For example, more than 3000 road and rail bridges exist in the state of Queensland. Some were primarily constructed using steel, while others used concrete, or timber, or some combination of these. Many have already exceeded their design life, however the financial and social cost to replace or close all of these aged structures would be prohibitively high. With appropriate maintenance and engineering, these bridges can continue to operate safely without risk of catastrophic failure (see Figure 1). Understanding the risks associated with an ageing structure, such as a bridge, requires an understanding of the loads it has been subjected to and the incremental damage that these loads have induced. A range of transducers can be used to measure, log, and report data including strain (how much a component has been stretched in tension or squashed in compression), displacement (how much a component has moved relative to another), acceleration (frequency and magnitude of vibration), and temperature. These data can be analysed in real-time to provide an up-to-date health assessment of the structure. The Problem During a routine inspection, cracks were found in one of the steel girders of the Wild River Bridge (see Figure 2). As a temporary safety measure, the bridge's managing authority reduced traffic to a single lane and lowered the speed limit to 60 km/h. The inconvenience left local residents unhappy and so a campaign of bridge monitoring, including strain gauges and displacement transducers, was expedited to assess risk and inform the design of repairs. One day's worth of these data have been provided to you for analysis.
18.29m 1451m SW NE 22.86m 22.86m VW8 VW20 VW28 Figure 2: Schematic diagram of the Wild River Bridge, showing the directions of travel and the location of three of the installed strain gauges. The data have been provided as 26 .dat files and a .txt file that lists all of their names. Also included is a down-sampled (i.e. much smaller) file, Event.SAMPLE. dat, which you can use for testing and debugging your code. The information in each file is stored as comma separated variables (i.e. .csv format) and so can be opened in Excel for inspection (if necessary). Each file represents the logging of an event¹, which is typically a vehicle crossing the bridge. Each file contains some metadata followed by columns for timestamps, record numbers, and the data from each gauge or transducer. VW_1 to VW_32 are the data from vibrating-wire strain gauges in units of microstrain² and DIS_1 to DIS_4 are the data from displacement transducers in units of millimetres (see Figure 3 for examples of strain data). The rows are separated by intervals of 0.005 s (i.e. the data are sampled at 200 Hz).
Task 5 (4 marks) A number of useful quantitative metrics can be extracted from the data provided. These include the maximum tensile and compressive strain, the strain reversal³, the range of component movement, and the speed and mass of a vehicle on the bridge. Write a function, analyse_event, that calculates the following for a single event and returns them from the function: The maximum and minimum measurement (strain or displacement, depending on gauge type), and the measurement range (strain reversal or range or movement), from each gauge; The name of the gauge that measures the greatest strain reversal during the event; 3 The vehicle's transit time between VW_8 and VW_28 for the event; 4 The average speed of the vehicle, as calculated using the transit time between VW_8 and VW_28, and; 5 The direction of vehicular travel, either "SW" or "NE", during the event. def analyse event (times: ndarray, header: list[str], data: ndarray) \ -> tuple [ndarray, str, float, float, str]: 3 Ő Apply this function to the data imported from the first event (i.e. Event.20210501_000900.dat). You can use this function to analyse other events, if you wish.
Task 6 (4 marks) Using the functions already written in Tasks 1 to 5, it is possible to analyse all of the events as a group and extract statistics such as the breakdown of different load magnitudes, vehicle speeds, and travel directions. Practically, this information could be used in fatigue analysis, to identify the frequency of vehicles exceeding the temporary speed limit, or general usage behaviour. Write a function, analyse_all, that iterates through each file and collates the following information into their own arrays, which are then returned by the function: 1 The start time of the event (as datetime64 objects); The average vehicle speed during the event as calculated using VW_8 and VW_28; The direction of travel during the event as calculated using VW_8 and VW_28, and; 4 The strain reversal measured at a specified gauge. 1 def analyse_all (data_dir: str, file_list: list [str])\ 2 -> tuple [ndarray, ndarray, ndarray, ndarray, bool]: 4 The function should prompt the user to input the name of the gauge from which the strain reversals are to be extracted, whether raw or averaged data is to be used in the analysis, and the width of the averaging window, if required. From this, the function should also return if averaged data was or was not used (see (5). Use this function to analyse all events and interrogate the strain reversals from VW 8 using both raw and averaged data with a window width of 51. You can use this function to interrogate other gauges and transducers if you wish 3
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply