PTT_LabManual
PTT_LabManual
B.E. II YEAR
Session: Jan-June, 2025
BM: 29502 Programming Tools & Techniques
Lab Manual
Name of Student:
Class:
Enrolment No:
Institute Mission
To generate experts in science and technology akin to society for its
accelerated socioeconomic growth in professional and challenging
environment imparting human values.
Department Vision
Department Mission
To bridge the engineering, science and healthcare sectors for
indigenous development and to impart community services for mass
healthcare through continuous research.
To encourage students for higher studies in technology and management and promote
PEO 5
lifelong learning attitude.
PO 2: Problem analysis: Identify, formulate, research literature, and analyses complex engineering problems
reaching substantiated conclusions using first principles of mathematics, natural sciences, and engineering
sciences.
3: Design/Development of Solutions: Design solutions for complex engineering problems and design system
components or processes that meet the specified needs with appropriate consideration for public health and safety,
and cultural, societal, and environmental considerations.
PO 4: Conduct investigations of complex problems: Use research-based knowledge and research methods
including design of experiments, analysis and interpretation of data, and synthesis of the information to provide
valid conclusions.
Competency Performance Indicators
4.1 Demonstrate an ability to conduct 4.1.1 Define a problem, its scope and importance for purposes of
investigations of technical issues investigation
consistent with their level of knowledge 4.1.2 Examine the relevant methods, tools and techniques of experiment
and understanding design, system calibration, data acquisition, analysis and presentation
4.1.3 Apply appropriate instrumentation and/or software tools to make
measurements of physical quantities
4.1.4 Establish a relationship between measured data and underlying
physical principles.
PO 5: Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern engineering
and IT tools including prediction and modeling to complex engineering activities with an understanding of the
limitations.
5.2 Demonstrate an ability to select and 5.2.1 Identify the strengths and limitations of tools for (i) acquiring
apply discipline-specific tools, information, (ii) modeling and simulating, (iii) monitoring system
techniques and resources performance, and (iv) creating engineering designs.
5.2.2 Demonstrate proficiency in using discipline-specific tools
5.3 Demonstrate an ability to evaluate 5.3.1 Discuss limitations and validate tools, techniques and resources
the suitability and limitations of tools 5.3.2 Verify the credibility of results from tool use with reference to the
used to solve an engineering problem accuracy and limitations, and the assumptions inherent in their use.
6.2 Demonstrate an understanding of 6.2.1 Interpret legislation, regulations, codes, and standards relevant to
professional engineering regulations, your discipline and explain its contribution to the protection of the
legislation and standards public
PO 7: Environment and sustainability: Understand the impact of the professional engineering solutions in
societal and environmental contexts, and demonstrate the knowledge of, and the need for sustainable development.
7.2 Demonstrate an ability to apply 7.2.1 Describe management techniques for sustainable development
principles of sustainable design and 7.2.2 Apply principles of preventive engineering and sustainable
development development to an engineering activity or product relevant to the
discipline
PO 8: Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of the
engineering practice.
PO 9: Individual and team work: Function effectively as an individual, and as a member or leader in diverse
teams, and in multidisciplinary settings.
9.3 Demonstrate success in a team-based 9.3.1 Present results as a team, with smooth integration of contributions
project from all individual efforts
PO 10: Communication: Communicate effectively on complex engineering activities with the engineering
community and with the society at large, such as being able to comprehend and write effective reports and design
documentation, make effective presentations, and give and receive clear instructions
PO 11: Project management and finance: Demonstrate knowledge and understanding of the engineering and
management principles and apply these to one’s work, as a member and leader in a team, to manage projects and
in multidisciplinary environments.
PO 12: Life-long learning: Recognize the need for, and have the preparation and ability to engage in independent
and life-long learning in the broadest context of technological change.
1) Students should come fully prepared to the laboratory for the experiments to be performed. He
should write down/read beforehand the objective of the experiment, list of test and measuring
equipment required, theory of the experiments and observation table.
2) Students should read and observe all the precautions to be taken during the experiment. Some of
the precautions include the following:
a) Make sure to create a folder with your student ID and save all your work in the same.
b) Ensure all programs / work are stored properly.
c) Do not change any defaults like wallpapers, location of folder that are not yours or system files.
d) Make sure to take a screenshot of the correct outputs.
3) After the experiment is over, shut down the notebook session, computers, fans, lights, etc.
4) Submit your practical file to the instructor of that day on the next turn and get your work checked
by him/her.
Course Outcomes
CO1 To understand the basic concepts of OOPS and various programming platforms.
CO2 To get acquainted with basic Python and MATLAB programming.
CO3 To apply the concepts of OOPs in Python.
CO4 To apply Python programming and MATLAB for solving standard engineering
problems.
CO5 To evaluate and compare the performance of different existing platforms.
Remark if any…………………
Signature of Professor
● EXPERIMENT NO. 1
Aim: Creating Class, Method and Object in Python.
Objectives: To learn the basic principles Object Oriented Programming (OOP) applied in Python
Language.
Requirements: Computer – Laptop or Desktop installed with Python and Jupyter Notebook Package.
For instance, an object could represent a person with properties like a name, age, and address and
behaviours such as walking, talking, breathing, and running. Or it could represent an email with properties
like a recipient list, subject, and body and behaviours like adding attachments and sending.
Put another way, object-oriented programming is an approach for modelling concrete, real-world
things, like cars, as well as relations between things, like hospitals and patients, students and teachers, and
so on. OOP models real-world entities as software objects that have some data associated with them and
can perform certain functions.
Another common programming paradigm is procedural programming, which structures a program
like a recipe in that it provides a set of steps, in the form of functions and code blocks, that flow
sequentially in order to complete a task.
The key takeaway is that objects are at the centre of object-oriented programming in Python, not
only representing the data, as in procedural programming, but in the overall structure of the program as
well.
Primitive data structures—like numbers, strings, and lists—are designed to represent simple pieces
of information, such as the cost of an apple, the name of a poem, or your favourite colours, respectively.
What if you want to represent something more complex?
For example, let’s say you want to track patients visiting a doctors clinic. You need to store some
basic information about each patient, such as their patient ID, visit date, name, gender, date of birth,
address, contact number, weight, body temperature, blood pressure, SpO2 level, and heart rate.
The properties that all objects must have are defined in a method called .__init__(). Every time a
new object is created, .__init__() sets the initial state of the object by assigning the values of the object’s
properties. That is, .__init__() initializes each new instance of the class.
You can give .__init__() any number of parameters, but the first parameter will always be a
variable called self. When a new class instance is created, the instance is automatically passed to the self
parameter in .__init__() so that new attributes can be defined on the object.
Attributes created in .__init__() are called instance attributes. An instance attribute’s value is
specific to a particular instance of the class. All patient objects have a name and an age, but the values for
the name and age attributes will vary depending on the patient instance.
On the other hand, class attributes are attributes that have the same value for all class instances.
You can define a class attribute by assigning a value to a variable name outside of .__init__().
Class attributes are defined directly beneath the first line of the class name. They must always be
assigned an initial value. When an instance of the class is created, class attributes are automatically
created and assigned to their initial values.
Use class attributes to define properties that should have the same value for every class instance.
Use instance attributes for properties that vary from one instance to another.
Creating a new object from a class is called instantiating an object. You can instantiate a new
patient object by typing the name of the class, followed by opening and closing parentheses.
In order to see what gets printed, you can define a special instance method called .__str__().
Procedure:
1. Install and initiate a Jupyter Notebook.
2. Make small python snippets:
2.1 Print “Hello World!”
2.2 Print the number 5
2.3 Print “*” in a triangle, inverted triangle and diamond shape of max length 5 with spaces in
between.
2.4 Make a python program for a basic calculator for 2 numbers and 1 function as input.
3. Make a list L1=[1, ‘Apple’, ‘Cat’, 3.14186]
4. Make a function called “foo” that does nothing.
5. Define a class called Book..
6. Add Class Attribute Library = “Departmental Library, Bio-Medical Engineering”
7. Add Instance Attributes like Book ID, Author, Student ID, Check out Date, Return Date.
8. Initiate the following book check-out instances:
B01032022001 = [“001”, “Ruth”, “0108BM2022010”, “11 May 2022”, “10 June 2022”];
B01032022002 = [“002”, “Holmes”, “0108BM2022010”, “19 May 2022”, “10 July 2022”];
9. Add a method ‘Duration’ to calculate the number of days the book was checked out. Check in and
checkout times are noon.
Result/conclusion:
Remark if any…………………
Signature of Professor
● EXPERIMENT NO. 2
Aim: Creating OOP structure for Patients
Objectives: To apply basic principles Object Oriented Programming (OOP) in Python Language.
Requirements: Computer – Laptop or Desktop installed with Python and Jupyter Notebook Package.
Theory: Build the Object Oriented structure for Patients visiting a Clinic. You need to store some basic
information about each patient, such as their patientid, visit date, name, gender, date of birth, address,
contact number, weight, body temperature, blood pressure, SpO2 level, and heart rate.
Procedure:
10. Define a class called Patient.
11. Add Class Attribute Doctor = “Dr. AN”
12. Add Instance Attributes like patientid, visit date, name, gender, weight, body temperature, blood
pressure.
13. Initiate the following patients:
P01092022001 = [“001”, “01Sep2022”, “Amey”, M, “60kg”, 98.2, 80/120];
P01092022002 = [“002”, “01Sep2022”, “Naksh”, M, “20kg”, 97.2, 80/120];
P01092022003 = [“003”, “01Sep2022”, “Raju”, M, “40kg”, 98.1, 86/110];
P01092022004 = [“004”, “01Sep2022”, “Pari”, F, “10kg”, 97.4, 82/125];
P01092022005 = [“005”, “01Sep2022”, “Simi”, F, “40kg”, 97.6, 85/130];
14. Add instance methods like Patient Information and Vitals
15. Replace Patient Information to __str__ method
Remark if any…………………
Signature of Professor
● EXPERIMENT NO. 3
Aim: Characteristics of OOP Encapsulation, Inheritance, Polymorphism in Python.
Objectives: To learn the basic principles Object Oriented Programming (OOP) applied in Python
Language.
Requirements: Computer – Laptop or Desktop installed with Python and Jupyter Notebook Package.
Theory: We have built a basic structure, now using OOP characteristics lets add some versatility to our
program.
Procedure:
16. Patient Health Information (PHI) is a privacy matter. In order for the clinic to be compliant with
the PHI laws, we need to make Patient Name private, thereby adding a little anonymity to the data.
This is done by encapsulation.
17. In order to generalize our program more we need to build classes based on the patient age group:
Pediatric (0-12yo), Teen(12-18yo), Adult (18-60yo) and Geriatric(60-100yo). Most information
that is to be collected for all these age based groups will still be the same. We will use inheritance
to form these new patient classes.
18. Generally clinics are used to diagnose and treat basic symptoms. We will first add dict mapping
basic symptoms for patient class.
Symptom={1:Cold, 2: Cough, 3: Fever, 4: Body Ache, 5: Chills}
19. Similarly there can be certain diagnostic tests that are age and pre-condition based. Using
polymorphism we will allow for more attributes in symptoms.
Pediatrics will mostly need tracking for Vaccines and BMI Normalcy
Teenagers will mostly require tracking for Dermatology conditions and OB GYN check-ups.
Adults will mostly require tracking for Lipids, Triglycerides, Glucose and Thyroid
Old patients will mostly require tracking for Joint Pains and Neurological Health.
Remark if any…………………
Signature of Professor
● EXPERIMENT NO. 4
Aim: Introduction to MATLAB.
Theory: Following the basic introduction in class, we know that MATLAB interface has windows for
Current Directory, Workspace, Command History, Editor and if required, figure windows. We can move
these around within or outside the interface to suit our customization. We can also choose to show some
and not other windows as we please.
Next, we will write small snippets to explore various functionalities of MATLAB.
Procedure:
20. Write a small program to calculate pi from fraction and display output to number of decimal places
as chosen by the user.
21. Write a small program to draw a circle and show output in the figure window.
22. Find if the number input by the user is prime or not and print out the result.
23. Write a program for line for x equidistant between 1 and 20, distance as chosen by the user and y
as 5.
Result/conclusion:
Remark if any…………………
Signature of Professor
● EXPERIMENT NO. 5
Aim: Reading and plotting Histogram of grey images in MATLAB
Theory: Most radiology images are grayscale, so it is important to be able to understand them and extract
relevant information from them. One such information is the frequency at which a particular grey value
appears in the image. In this experiment we learn how we do this using a histogram and extract some
information.
Procedure:
24. Create a 1000 x 1000 matrix of random numbers between 1 and 300 and display histogram for
bins as 1-200; 200-250; 250-270; 270-290 and 290-300.
25. Normalize the matrix in 38 to values between 1 to 100.Read grayscale image
26. Plot histogram
27. Extract mean and median values
28. Normalize the image from 1-100
29. Modify the histogram bins to show as per 1 to 3 standard deviations.
Result/conclusion:
Remark if any…………………
Signature of Professor
● EXPERIMENT NO. 6
Aim: SIMULINK Modelling and Creating GUI in MATLAB.
Theory: Simulink is a simulation interface that allows the user to create customized simulations. Users
can either choose predefined functional blocks from different libraries or customize required blocks to
change behaviour. Users can also print the code to make major edits. Graphical User Interface (GUI) is
an application development environment that also allows users to convert ideas into an application.
Different elements with predefined behaviours can be added from the library and their characteristics can
be edited to link them with each other and functions.
Procedure:
30. Create a Simulink model to input a sine wave and display the same on the scope.
31. Create a Simulink model to input a sine wave but display a cosine wave.
Result/conclusion:
Q2. Make a GUI for the above SIMULINK model but output is a figure for user defined slope and
constant?
Institute Mission
To generate experts in science and technology akin to society for its
accelerated socioeconomic growth in professional and challenging
environment imparting human values.
Department Vision
Department Mission
To bridge the engineering, science and healthcare sectors for
indigenous development and to impart community services for mass
healthcare through continuous research.