summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tutorials/module_1/classes_and_objects.md187
-rw-r--r--tutorials/module_1/intro_to_anaconda.md33
-rw-r--r--tutorials/module_4/4.4 Statistical Analysis.md2
-rw-r--r--tutorials/module_4/Spectroscopy problem.md61
-rw-r--r--tutorials/module_4/spectroscopy_problem/spectroscopy.py20
5 files changed, 256 insertions, 47 deletions
diff --git a/tutorials/module_1/classes_and_objects.md b/tutorials/module_1/classes_and_objects.md
index 8a0be85..759a3a3 100644
--- a/tutorials/module_1/classes_and_objects.md
+++ b/tutorials/module_1/classes_and_objects.md
@@ -43,74 +43,172 @@
---
# Modular Programming
-OOP
-What is it?
Modular programming or better known as Object-Oriented Programming (OOP) is a way we can structure programs so that properties and behaviors of objects are grouped together. It allows us to re-use code which simplifies the code for better readability in larger programs and reduces the potential for bugs. You're probably familiar with the saying "Don't re-invent the wheel". OOP is the programmers solution to this. Python allows us to import libraries so that we don't have to write everything from scratch. The libraries used in this course provide us with algorithms to calculate a solution, structure data and plot data. When looking at the source code of these library you may see keywords, such as `class`. This tutorial will delve into the fundamental concepts of OOP.
-One analogy for OOP goes as follows. If we were to build a house we need to follow a common structure or blueprint which defines what a house should have, this is the *class*. The class may be thought of as the blueprint for a house, defining what a house should include (rooms, doors and windows). Then we have *objects* which is the actual house that is built from the blueprint. You can build multiple objects from the same plan.
+#### Classes
+One analogy for OOP goes as follows. Imagine you are an urban planner in the town of Wellington, the town is rapidly expanding and housing is in high demand. You are tasked with developing a new housing area. Designing 50 different houses will take too much, but building the same house 50 times will make the neighborhood look like a subdivision from the 1950s. Your solution may be to come up with some structure that represents a house, this is our `class`. This structure may define how a house should look like, for example, a house should have doors, rooms and windows. Even though every house won't looks that same, they all will follow the same patterns. Properties such as color, window types, garage type can be introduced inside the `class` however it will not be define until we build the specific house.
-Imagine you are an urban planner in the town of Wellington, the town is rapidly expanding and housing is in high demand. You are tasked with developing a new housing area. Designing 50 different houses will take too much, but building the same house 50 times will make the neighborhood look like a subdivision from the 1950s.
+#### Objects
+Once we have the general structure of what a house is going to look like, we can use this blueprint to start building houses faster. With this blueprint defined. We can start building houses from the blueprint. In python we call this *initializing objects*. Where an actual house built from this blueprint with specific attributes (e.g. house #305, blue house, single-hung window, attached garage) is referred to as an `object`.
-Class: Is the blueprint of the house
-Object: Is a specific house in the neighborhood with defined attributes
-Method: Attached garage
-
-
-Let's take a look at an example. Do not worry if you don't understand the syntax below, we will explain this later. Let's define the class:
+#### Example
+Let's take a look at an example. Of how this looks like in python. Do not worry if you don't understand the syntax below, we will explain this later. Let's define the class:
```python
-class People():
- def __init__(self, name, age):
- self.name = name
- self.age = age
+class House():
+ def __init__(self, house_number, color, garage_type):
+ self.house_number = house_number
+ self.color = color
+ self.garage_type = garage_type
- def greet(self):
- print("Greetings, " + self.name)
+ def describe(self):
+ print("House #" + self.house_number + " is painted " + self.color)
+ print("and has a " + self.garage_type + " garage.")
```
Now we can use our class to define new objects:
```python
-person1 = People(name = 'Iron Man', age = 35)
-person1.greet()
-print(person1.name,person1.age)
+house1 = House(house_number=101, color='blue', garage_type='attached')
+house1.describe()
-person2 = People(name = 'Batman', age = 33)
-person2.greet()
-print(person2.name,person2.age)
+house2 = House(house_number=102, color='green', garage_type='detached')
+house2.describe()
```
-In the example above we first defined the class `People` with `name` and `age` as the data and the `greet` as the method. Once we initialized an object `person1` we can see that the class defines the entire structure, whilst the object is just an instance of the class. It is clear that `person1` and `person2` are independent with each other, though they are all instantiated from the same class.
+In the example above, we first defined the class `House` with `house_number`, `color`, and `garage_type` as the data (attributes), and `describe()` as the method. Once we initialized objects such as `house1` and `house2`, we can see that the class provides the overall blueprint, while each object is an individual house built from that blueprint. It is clear that `house1` and `house2` are completely independent from one another, even though they were both created using the same `House` class.
+
+>[!NOTE] Attributes
+> Data that is stored within an object.
- 3. Why use it?
-You may wonder why you should even bother with classes and object. Why not store data as arrays?
+>[!NOTE] Methods
+>A function that lives inside a class and has access to the data stored inside the object. usually
+
+### Why use it?
+When you start to represent more complex data primitive data structures, such as arrays become more difficult to manage. Let's consider you're trying to track employees in an organization. You may need to store name, age, position and year of recruitment. One way to represent this would be as follows:
```python
kirk = ["James Kirk", 34, "Captain", 2265]
spock = ["Spock", 35, "Science Officer", 2254]
mccoy = ["Leonard McCoy", "Chief Medical Officer", 2266]
```
+There are a number of issues with this approach. First, it can make larger code files more difficult to manage. If you reference `kirk[0]` several lines away from where you declared the `kirk` list, will you remember that the element with index `0` is the employee’s name? Second, it can introduce errors if employees don’t have the same number of elements in their respective lists. In the `mccoy` list above, the age is missing, so `mccoy[1]` will return `"Chief Medical Officer"` instead of Dr. McCoy’s age.
+
+The modularity of the programs allows us to re-use code which reduces the number of potential bugs.
+
+#### Four Pillars of OOP
+Now that we know how classes and objects look like. Let's take a look at the four fundamental concepts in OOP.
+
+The four pillars:
+ 1. Inheritance - enables the creation of hierarchical relationships between classes, allowing a subclass to inherit attributes and methods from a parent class. This promotes code reuse and reduces duplication.
+ 2. Encapsulation - allows you to bundle data (attributes) and behaviors (methods) within a class to create a cohesive unit. By defining methods to control access to attributes and its modification, encapsulation helps maintain data integrity and promotes modular, secure code.
+ 3. Polymorphism - allows you to treat objects of different types as instances of the same base type, as long as they implement a common interface or behavior. Python’s duck typing make it especially suited for polymorphism, as it allows you to access attributes and methods on objects without needing to worry about their actual class.
+ 4. Abstraction - focuses on hiding implementation details and exposing only the essential functionality of an object. By enforcing a consistent interface, abstraction simplifies interactions with objects, allowing developers to focus on what an object does rather than how it achieves its functionality.
+
+
+## Examples:
+
+#### Modelling physical systems
+We can model components as classes where we specify it's properties as attributes and behavior as methods. Use the provided equations to calculate the torque
+
+a) Using the equations below, model the component as a class.
+$$
+\tau(I) = K_t * I \tag{}
+$$
+$\tau$ - is the torque produced by the motor
+$K_t$ - torque constant
+$I$ - current flowing through the motor
+$$
+I(f) = \frac{V - K_t * f}{R} \tag{}
+$$
+$V$ -> Voltage provided to the circuit
+$K_t$ -> torque constant
+$f$ -> motor speed (rev/s or Hz)
+$R$ -> Resistance of the motor
+
+
+```python
+class Motor:
+ def __init__(self, torque_constant, resistance, voltage):
+ self.Kt = torque_constant
+ self.R = resistance
+ self.V = voltage
+
+ def current(self, speed):
+ return (self.V - self.Kt * speed) / self.R
+
+ def torque(self, speed):
+ return self.Kt * self.current(speed)
+```
- 1. Simplifies the code for better readability.
- 2. reduces the number of potential bugs.
- 4. Real world uses
- 1. Python Libraries/Packages
-2. Core concepts
- 1. Class (Blueprints)
- A class is used to define logical grouping of data and functions and objects.
- 2. Objects ()
- 3. Attributes
- 4. Methods - A **method** is a **function that lives inside a class** and has access to the data stored inside the object.
- 5. The four pillars:
- 1. Encapsulation
- 2. Inheritance
- 3. Abstraction
- 4. Polymorphism
-3. Syntax and Examples
+b) You've selected 3 candidates to power an electrical powered car. with the specs given in the table below. The motor you're given is spec'ed with a torque constant $0.05 Nm/A$, resistance in the motor of $2.0 \Omega$ which is powered by battery of $12V$.
+| Motor | $K_t$ | $R$ | Battery |
+| ----- | ----- | ---- | ------- |
+| 1 | 0.05 | 2 | 12V |
+| 2 | 0.05 | 2 | 24V |
+| 3 | 0.1 | 1.75 | 12V |
+```python
+motor1 = Motor(0.05, 2.0, 12)
+motor2 = Motor(0.05, 2.0, 12)
+motor3 = Motor(0.05, 2.0, 12)
+print(motor1.torque(100)) # torque at 100 rad/s
+```
+
+
+#### Simulation Frameworks
+Use of *inheritance* and *composition*.
+```python
+class PropulsionSystem:
+ def __init__(self, mass_flow_rate):
+ self.mass_flow_rate = mass_flow_rate
+
+ def thrust(self, exhaust_velocity):
+ return self.mass_flow_rate * exhaust_velocity
+
+
+class RocketEngine(PropulsionSystem):
+ def __init__(self, mass_flow_rate, chamber_pressure, area_ratio):
+ super().__init__(mass_flow_rate)
+ self.chamber_pressure = chamber_pressure
+ self.area_ratio = area_ratio
+
+ def efficiency(self):
+ return 0.98 # simplified example
+```
+
+#### Data Processing Pipeline
+```python
+class DataLogger:
+ def __init__(self, filepath):
+ import pandas as pd
+ self.df = pd.read_csv(filepath)
+
+ def filter_noise(self):
+ self.df['filtered'] = self.df['signal'].rolling(5).mean()
+
+ def plot(self):
+ self.df[['signal', 'filtered']].plot()
+```
+
+
+#### Simulation of a mass-spring-damper system
+Model a spring-mass-damper system using classes and
+
+```python
+class Spring:
+ def __init__(self, spring_constant)
+ self.K = spring_constant
+ self.
+```
+- B. Creating reusable components (e.g., `Material`, `Beam`, `Force`)
+
+https://github.com/enesdemirag/programming-exercises/blob/master/exercises/mass-spring-damper-simulation.md
+
+### Summary
```mermaid
flowchart TD
A[OOP] --> B[Class]
- B --> C[Attributes: variables / data]
- B --> D[Methods: functions / behaviors]
+ B --> C["Attributes (variables and data)"]
+ B --> D["Methods (functions and behaviors)"]
C -->|define structure| E[Class Definition]
D -->|define behavior| E
@@ -123,6 +221,9 @@ flowchart TD
+
+---
+
Starting a class is done with the `class` keyword followed by the name of the class.
```python
class Dog:
diff --git a/tutorials/module_1/intro_to_anaconda.md b/tutorials/module_1/intro_to_anaconda.md
index f123836..4ce5e7c 100644
--- a/tutorials/module_1/intro_to_anaconda.md
+++ b/tutorials/module_1/intro_to_anaconda.md
@@ -11,6 +11,39 @@ The Anaconda website nicely describes *Navigator* as:
To better understand how Navigator works and interacts with the anaconda ecosystem see the figure below.
![Anaconda Schematic](figures/AnacondaSchematic.png)
+
+```mermaid
+flowchart TB
+ %% Sections
+ subgraph BE[Back-end]
+ C["Conda (Package Manager)"]
+ E[Environments]
+ subgraph Libs[Libraries]
+ L1[Numpy]
+ L2[Pandas]
+ L3[Matplotlib]
+ end
+ end
+
+ subgraph FE["Front-end (What you see)"]
+ N["Navigator (Graphical Interface)"]
+ subgraph IDE["Integrated Development Environments (IDE)"]
+ S[Spyder]
+ J[JupyterLab]
+ end
+ end
+
+ A[Anaconda]
+
+ %% Connections
+ A --> N
+ N -->|Launches| IDE
+ N -->|Selects| E
+ C --> E --> Libs
+ A --> C
+
+```
+
As you schematic indicated, Navigator is a tool in the Anaconda toolbox that allows the user to select and configure python environments and libraries. Let's see how we can do this.
## Getting Started
diff --git a/tutorials/module_4/4.4 Statistical Analysis.md b/tutorials/module_4/4.4 Statistical Analysis.md
index 4272e8b..f61caa9 100644
--- a/tutorials/module_4/4.4 Statistical Analysis.md
+++ b/tutorials/module_4/4.4 Statistical Analysis.md
@@ -75,7 +75,7 @@ This helps to assess confidence in their results and identify outliers that may
>
>Takeaway: Statistical distributions aren’t just for data analysis they guide how reliable we make our products.
-## Spectroscopy
+## Practical Application: Spectroscopy
### Background
Spectroscopy is the study of how matter interacts with electromagnetic radiation, including the absorption and emission of light and other forms of radiation. It examines how these interactions depend on the wavelength of the radiation, providing insight into the physical and chemical properties of materials. This is how NASA determines the composition of planetary surfaces and atmospheres. It's also applied in combustion and thermal analysis where spectroscopy measure plasma temperature and monitors exhaust composition in rocket engines.
diff --git a/tutorials/module_4/Spectroscopy problem.md b/tutorials/module_4/Spectroscopy problem.md
index 429d387..18feeb9 100644
--- a/tutorials/module_4/Spectroscopy problem.md
+++ b/tutorials/module_4/Spectroscopy problem.md
@@ -41,8 +41,12 @@ A spectroscopy experiment is set up to collect the spectra discharges of Argon a
<img src="image_1762363220163.png" width="530">
*Fig 1: Spectroscopy experiment set-up for characterization for a plasma source in Argon and Oxygen.*
-
+The goals is for us to be able to record the intensity vs. wavelength in real units with any type of energy source. The calibration process will go as follows:
+1. Acquire data of unknown energy source
+2. Calibrate the wavelength dimension by measuring the wavelength of an energy source (Hg - mercury) with well known wavelengths.
+3. Calibrate the intensity dimension by measuring the intensity of a known energy source (W - tungsten) with well know intensities.
### Calibration of spectrometer
+
Problem 1: Plot the intensity of the mercury lamp as a function of pixel count.
Problem 2: The goal want to convert our distance dimension units from pixel to wavelength. To calibrate the wavelength readings (x-axis) by matching the peaks of the spectra to literature data. To calibrate the wavelength readings (x-axis), use linear regression to convert the pixel count to true wavelength ($nm$). The following equation can be used:
@@ -131,4 +135,57 @@ $$
-
+||Intensity||![](https://www.physics.nist.gov/PhysRefData/Handbook/Images/spacer.gif)||Air <br>Wavelength (Å)||![](https://www.physics.nist.gov/PhysRefData/Handbook/Images/spacer.gif)||Spectrum||![](https://www.physics.nist.gov/PhysRefData/Handbook/Images/spacer.gif)||Reference||
+|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+|![](https://www.physics.nist.gov/PhysRefData/Handbook/Images/spacer.gif)| | | | | | | | | | | | | | | |
+||||![](https://www.physics.nist.gov/PhysRefData/Handbook/Images/spacer.gif)||||![](https://www.physics.nist.gov/PhysRefData/Handbook/Images/spacer.gif)||||![](https://www.physics.nist.gov/PhysRefData/Handbook/Images/spacer.gif)||||
+|20|2026.860|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|400 [P](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable4.htm#2052.828)|2052.828|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|20|2224.711|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|10|2252.786|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|60|2260.294|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|400 [P](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable4.htm#2262.223)|2262.223|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|10|2263.634|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|1000 [P](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable3.htm#2536.517),c|2536.517|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|25|2652.039|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|40|2653.679|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|400 [P](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable4.htm#2847.675)|2847.675|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|30|2916.250|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|25|2947.074|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|250 [P](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable3.htm#2967.280)|2967.280|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|70|3021.498|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|90|3125.668|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|80|3131.548|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|80|3131.839|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|12|3208.169|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|10|3532.594|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|10|3605.762|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|600 [P](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable3.htm#3650.153)|3650.153|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|70|3654.836|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|50|3663.279|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|1000 [P](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable4.htm#3983.931),c|3983.931|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|400 [P](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable3.htm#4046.563)|4046.563|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|60|4339.223|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|100|4347.494|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|1000 [P](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable3.htm#4358.328)|4358.328|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|12 c|5128.442|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|15|5204.768|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|80 [P](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable4.htm#5425.253)|5425.253|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|500 [P](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable3.htm#5460.735)|5460.735|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|200 [P](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable4.htm#5677.105)|5677.105|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|50|5769.598|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|60|5790.663|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|12|5871.279|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|20 c|5888.939|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|15|6146.435|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|250 [P](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable4.htm#6149.475),c|6149.475|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|25|7081.90|Hg I|[F54](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#F54)|
+|6|7346.508|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|250 [P](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable4.htm#7944.555)|7944.555|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|6 h|9520.198|Hg II|[SR01](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#SR01)|
+|200 [P](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable3.htm#10139.76)|10139.76|Hg I|[BAL50](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#BAL50)|
+|50|13570.21|Hg I|[H53](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#H53)|
+|40|13673.51|Hg I|[H53](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#H53)|
+|50|15295.82|Hg I|[H53](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#H53)|
+|50|17072.79|Hg I|[H53](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#H53)|
+|25|23253.07|Hg I|[PBT55](https://www.physics.nist.gov/PhysRefData/Handbook/Tables/mercurytable7.htm#PBT55)| \ No newline at end of file
diff --git a/tutorials/module_4/spectroscopy_problem/spectroscopy.py b/tutorials/module_4/spectroscopy_problem/spectroscopy.py
index f32ca52..f66734a 100644
--- a/tutorials/module_4/spectroscopy_problem/spectroscopy.py
+++ b/tutorials/module_4/spectroscopy_problem/spectroscopy.py
@@ -49,8 +49,25 @@ plt.show()
"Calibrate length dimension"
-np.polyfit(df_Hg['Pixels'],df_Hg['Intensity'],3)
+C = np.polyfit(df_Hg['Pixels'],df_Hg['Intensity'],3)
+lambda_Hg = lambda p : C[3] + C[2]*p+C[1]*p**2+C[0]*p**3
+
+lambda_calibrated = lambda_Hg(df_Hg['Pixel'])
+
+
+# Plot Hg intensity-wavelength plot
+plt.figure(figsize=(8,5))
+plt.plot(lambda_Hg, df_Hg['Intensity'], linestyle='-')
+plt.xlabel('Wavelength [nm]')
+plt.ylabel('Intensity [a.u.]')
+plt.title('Wavelength-Intensity (Hg)')
+plt.grid(True)
+plt.show()
+
+
+
+"""
"Calibrate intensity dimension"
epsilon = # Surface emissivity
lambd =
@@ -59,3 +76,4 @@ I_W_true = epsilon*((2hc**2)/(lambd**5)*1/(e**(hc/kT)-1))
I_W_meas= df_Ox['I_Tungsten [a.u.]']
R=I_W_meas/I_W_true
I_plasma_meas=R*I_plasma_true
+""" \ No newline at end of file