Optical 模組
光學特性數據處理模組。
結構
Optical/
├── __init__.py # Optical (Writer 入口)
├── _IMPROVE.py # IMPROVE 消光方程
├── _mie.py # Mie 理論計算
├── _mie_sd.py # Mie 粒徑分布計算
├── _retrieve_RI.py # 折射率反演
├── _derived.py # 衍生光學參數
├── mie_theory.py # Mie 混合模式
└── coefficient.py # 散射/吸收係數
快速開始
from pathlib import Path
from AeroViz.dataProcess import DataProcess
dp = DataProcess('Optical', Path('./output'))
result = dp.IMPROVE(df_mass, df_RH, method='revised')
方法列表
| 方法 | 說明 | 相關理論 |
|---|---|---|
basic(df_sca, df_abs) |
基本消光特性 | - |
IMPROVE(df_mass, df_RH, method) |
IMPROVE 消光方程 | → IMPROVE |
gas_extinction(df_no2, df_temp) |
氣體消光貢獻 | → IMPROVE |
Mie(df_pnsd, df_m, wave_length) |
Mie 消光計算 | → Mie 理論 |
retrieve_RI(df_optical, df_pnsd) |
折射率反演 | → Mie 理論 |
derived(...) |
衍生光學參數 | - |
輸出說明
IMPROVE
| 輸出 | 說明 |
|---|---|
dry |
乾燥消光 (AS_ext, AN_ext, OM_ext, Soil_ext, SS_ext, EC_ext, Total_ext) |
wet |
濕消光 |
ALWC |
液態水貢獻 (wet - dry) |
fRH |
吸濕成長因子 |
Mie
| 輸出 | 說明 |
|---|---|
extinction |
消光係數 (Mm⁻¹) |
scattering |
散射係數 (Mm⁻¹) |
absorption |
吸收係數 (Mm⁻¹) |
retrieve_RI
| 輸出 | 說明 |
|---|---|
n |
實部 |
k |
虛部 |
derived
| 輸出 | 說明 |
|---|---|
| PG | 總消光 (Sca + Abs + Gas) |
| MAC | 質量吸收截面 (m²/g) |
| Ox | 氧化劑濃度 (NO₂ + O₃) |
| Vis_cal | 計算能見度 (km) |
| fRH_IMPR | IMPROVE fRH |
| OCEC_ratio | OC/EC 比值 |
| PM1_PM25 | PM1/PM2.5 比值 |
Mie 混合模式
| 模式 | 說明 |
|---|---|
internal |
內混合:體積加權平均折射率 |
external |
外混合:分別計算後加總 |
core_shell |
核殼結構:EC 核心 + 其他殼層 |
sensitivity |
敏感度分析 |
輸入格式
散射係數
吸收係數
質量濃度(IMPROVE 用)
相關資源
- 範例: 光學閉合分析
- 理論: IMPROVE 方程 | Mie 理論
API 參考
AeroViz.dataProcess.Optical.Optical
Bases: Writer
Functions
Mie
Calculate optical properties from PSD using Mie theory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df_psd
|
DataFrame
|
Particle number size distribution. Columns are particle diameters (nm), rows are time points. |
required |
df_m
|
DataFrame or Series
|
Complex refractive index (n + ik) for each time point. |
required |
wavelength
|
float
|
Wavelength of incident light in nm. |
550
|
psd_type
|
str
|
Type of PSD input: - 'dNdlogDp': Number concentration per log bin width (#/cm³) - 'dN': Number concentration per bin (#/cm³/bin) - 'auto': Auto-detect with warning if uncertain |
'auto'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Optical coefficients with columns: ext, sca, abs (Mm⁻¹) |
IMPROVE
Calculate extinction using IMPROVE equation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df_mass
|
DataFrame
|
Mass concentrations with columns: AS, AN, OM, Soil, SS, EC |
required |
df_RH
|
DataFrame
|
Relative humidity data |
None
|
method
|
str
|
IMPROVE version: 'revised' or 'modified' |
'revised'
|
df_nh4_status
|
DataFrame
|
NH4 status from reconstruction_basic()['NH4_status']. If provided, rows with 'Deficiency' status will be excluded. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary with keys: - 'dry': Dry extinction DataFrame - 'wet': Wet extinction DataFrame (if df_RH provided) - 'ALWC': Water contribution (wet - dry) - 'fRH': Hygroscopic growth factor |
gas_extinction
Calculate gas contribution to extinction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df_no2
|
DataFrame
|
NO2 concentration (ppb) |
required |
df_temp
|
DataFrame
|
Ambient temperature (Celsius) |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Gas extinction with ScatteringByGas, AbsorptionByGas, ExtinctionByGas |
retrieve_RI
Retrieve refractive index from optical and PSD measurements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df_optical
|
DataFrame
|
Optical data with Extinction, Scattering, Absorption columns |
required |
df_pnsd
|
DataFrame
|
Particle number size distribution data |
required |
dlogdp
|
float
|
Logarithmic bin width |
0.014
|
wavelength
|
float
|
Wavelength in nm |
550
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Retrieved refractive index with re_real and re_imaginary columns |
derived
derived(df_sca=None, df_abs=None, df_ext=None, df_no2=None, df_o3=None, df_ec=None, df_oc=None, df_pm1=None, df_pm25=None, df_improve=None)
Calculate derived optical and atmospheric parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df_sca
|
DataFrame
|
Scattering coefficient (Mm-1) |
None
|
df_abs
|
DataFrame
|
Absorption coefficient (Mm-1) |
None
|
df_ext
|
DataFrame
|
Extinction coefficient (Mm-1) |
None
|
df_no2
|
DataFrame
|
NO2 concentration (ppb) |
None
|
df_o3
|
DataFrame
|
O3 concentration (ppb) |
None
|
df_ec
|
DataFrame
|
Elemental carbon (ug/m3) |
None
|
df_oc
|
DataFrame
|
Organic carbon (ug/m3) |
None
|
df_pm1
|
DataFrame
|
PM1 (ug/m3) |
None
|
df_pm25
|
DataFrame
|
PM2.5 (ug/m3) |
None
|
df_improve
|
DataFrame
|
IMPROVE extinction data |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Derived parameters (PG, MAC, Ox, Vis_cal, fRH_IMPR, OCEC_ratio, etc.) |