Question: Consider the following code snippet, ( a ) Update the code as per the instructions ( see comments ( hashtags ) Note: Image of CSV
Consider the following code snippet,
a Update the code as per the instructions see commentshashtags Note: Image of CSV files is attached
#
# Name :
# ID :
#
# heat.py heat diffusion simulation
#
import numpy as np
import matplotlib.pyplot as plt
def calcheatsubarray:
result subarraysum subarray
return result
def loadDatafilename:
# Function to read heat source from a file
# File format x rows x cols
return harray, curr
def main:
size #Take the corresponding file size as user input.
filename #Take the corresponding file name as a user input.
harray, curr # Call the load data function
plotOption # take plotting option as input if : plot each step in the
# simulation, if : plot the final output,
next npzerossizesize
for timestep in range:
for r in range size:
for c in range size:
nextrc calcheatcurrr:r c:c
npwhereharraynext, harray, next
printTime step: timestep
printnext
curr next.copy
# Add code for updated plotting as per plotting option.
if namemain:
main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
