Modify the code below to resize the array into (1, 27) and (3, 9). Then set...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Modify the code below to resize the array into (1, 27) and (3, 9). Then set the element [0,0,1]=1, [1,1,2]=2 and [2,1,1]=3. Run the code and display the results. (Submit separately as a python file) ## zeros.py -creating and resizing an array# import numpy as np print("INZERO ARRAY\n') zeroarray = np.zeros((3,3,3)) print('Zero array size: , np.size(zeroarray)) print(Zero arrayshape: ', np.shape(zeroarray), "In') print(zeroarray) !! b) (5 marks) Modify to the following code to shift, rotate and crop the image. You can choose the coordinates of shifting yourself. (Submit separately as a python file) ## prettyface.py #import matplotlib.pyplot as plt from scipy import ndimage from scipy import miscface = misc.face(gray=True) pit.imshow(face) plt.imshow(face, cmap%3plt.cm.gray) plt.show() c) (10 marks) Write Linux commands for the following: To Change the name of the existing file. (2) To show the current working directory. (2) To go two levels up in the directory structure. (2) To change directory to GURRENTDIR. (2) To accept parameters at the command line rather than hard coding them within the program. (2) i. iv. V. Modify the code below to resize the array into (1, 27) and (3, 9). Then set the element [0,0,1]=1, [1,1,2]=2 and [2,1,1]=3. Run the code and display the results. (Submit separately as a python file) ## zeros.py -creating and resizing an array# import numpy as np print("INZERO ARRAY\n') zeroarray = np.zeros((3,3,3)) print('Zero array size: , np.size(zeroarray)) print(Zero arrayshape: ', np.shape(zeroarray), "In') print(zeroarray) !! b) (5 marks) Modify to the following code to shift, rotate and crop the image. You can choose the coordinates of shifting yourself. (Submit separately as a python file) ## prettyface.py #import matplotlib.pyplot as plt from scipy import ndimage from scipy import miscface = misc.face(gray=True) pit.imshow(face) plt.imshow(face, cmap%3plt.cm.gray) plt.show() c) (10 marks) Write Linux commands for the following: To Change the name of the existing file. (2) To show the current working directory. (2) To go two levels up in the directory structure. (2) To change directory to GURRENTDIR. (2) To accept parameters at the command line rather than hard coding them within the program. (2) i. iv. V.
Expert Answer:
Answer rating: 100% (QA)
PART A The modified code for the given problem is given below with the output import numpy as np pri... View the full answer
Related Book For
Elementary Linear Algebra with Applications
ISBN: 978-0471669593
9th edition
Authors: Howard Anton, Chris Rorres
Posted Date:
Students also viewed these accounting questions
-
Modify the code below to do the following: 1. Print out the value of GOLDEN_RATIO_PRIME in the simple_init() function. 2. Print out the greatest common divisor of 3,300 and 24 in the simple_exit()...
-
import numpy as np import pandas import matplotlibpyplot as plt import glob import sys import re from tabulate import tabulate def last9chars(x) return(x9) files sorted(globglob('Datatxt'),key...
-
NumPy package of Python can be used to calculate the mean measure. A) True B) False
-
Based on Exhibits 5 and 6, the value of the lower one-period forward rate is closest to: A. 3.5122%. B. 3.5400%. C. 4.8037%. Meredith Alvarez is a junior fixed-income analyst with Canzim Asset...
-
Discuss the rights, duties, and obligations of a forensic accountant hired to assist in a civil or criminal investigation.
-
Visit your local bank and observe the waiting line system. Describe the system in terms of number of lines, number of facilities, and number of phases.
-
1. Find the cumulative area that corresponds to a z-score of 1.15. 2. Find the cumulative area that corresponds to a z-score of 0.24.
-
Dibden Manufacturing Company set its standard variable manufacturing cost at $48 per unit of product. The company planned to make and sell 4,000 units of product during 2015. More specifically, the...
-
John, a Canadian citizen, and Maria, a citizen of Mexico, connected through an online international pen-pal program a year and a half ago. They began exchanging messages and developed a deep...
-
Gas absorption or gas scrubbing is a commonly used method for removing environmentally undesirable species from waste gases in chemical manufacturing and combustion processes. The waste gas is...
-
Iguana, Inc., manufactures bamboo picture frames that sell for $30 each. Each frame requires 4 linear feet of bamboo, which costs $2.50 per foot. Each frame takes approximately 30 minutes to build,...
-
True or False? A header node is a placeholder node at the beginning of a list, which is used to simplify list processing.
-
Write a class based on class SortedType as an unbounded arraybased implementation. If the dynamically allocated array is full, create an array double the size and move the elements into it.
-
True or False? A doubly linked list has two pointers in each node.
-
Refer to the data set weather.csv. Can you conclude that the proportion of times the record maximum has occurred after 1945 is greater than the proportion of times the record minimum has occurred...
-
The queue is implemented as a class containing an array of items, a data member indicating the index of the last item put on the queue (rear), a data member indicating the index of the location...
-
Problem - Im doing a simulation project, the project is about a store which is located in Havelock, Ontario. The store is about to refurbish itself with a new brand identity and add multiple things...
-
2.) Find the Laplace transform of f(t) 7e-St cos 2t +9 sinh2 2t. Use Laplace Table. %3D
-
Show that the inner product in Example 7 can be written as (U,V) = tr (UTV).
-
Find two different row-echelon forms of 2 2
-
Suppose that the characteristic polynomial of some matrix, 4 is found to be p() = ( - 1)( - 3)2(-4)3 In each part, answer the question and explain your reasoning (a) What is the size o f A? (b) Is A...
-
__________ is the special systems test that determines the time duration to process transaction data. (a) Peak load testing (b) Performance time testing (c) Unit testing (d) Recovery testing
-
The testing technique that requires devising test cases to exercise the internal logic of a software module is called ___________. (a) Black box testing (b) Special systems testing (c) Glass box...
-
From where test data (to test the system) are made available? (a) Live environment (b) Test libraries (c) Dummy data (d) All of these
Study smarter with the SolutionInn App