No project description provided
Project description
Welcome to citrine 💎
citrine is a small Python library to calculate the joint-spectra of nonlinear crystals used in parametric downconversion sources.
About
Features
- Calculate grating periods
- Produce Δk matrices for different crystals and phase matching conditions
- Pump envelope functions
- Phase matching functions
- Types for commonly used units
- e.g.
citrine.Wavelength
- e.g.
- Library of crystal parameters
citrine.crystalssub-module
Requirements
- numpy
Installation
python3 -m pip install citrine
Alternatively from Git
Install from git for the latest version
python3 -m pip install git+https://github.com/Peter-Barrow/citrine.git
Quick Examples
import citrine
import numpy as np
import matplotlib.pyplot as plt
# Define central wavelengths for pump, signal, and idler
lambda_p_central = citrine.Wavelength(775, Magnitude.nano)
lambda_s_central = citrine.Wavelength(1550, Magnitude.nano)
lambda_i_central = citrine.Wavelength(1550, Magnitude.nano)
# Define a range of wavelengths for signal and idler (in nm)
spectral_width = citrine.Wavelength(25, Magnitude.nano)
steps = 1024
lambda_s = citrine.spectral_window(lambda_s_central, spectral_width, steps)
lambda_i = citrine.spectral_window(lambda_i_central, spectral_width, steps)
# Define pump bandwidth (in nm and convert)
sigma_lambda_p = citrine.Wavelength(0.5, Magnitude.nano)
sigma_p = 2 * np.pi * citrine.bandwidth_conversion(sigma_lambda_p, lambda_p_central)
# Calculate grating period
grating_period = citrine.calculate_grating_period(
lambda_p_central,
lambda_s_central,
lambda_i_central,
citrine.crystals.ppKTP,
)
# Calculate Δk matrix
delta_k = citrine.delta_k_matrix(
lambda_p_central,
lambda_s,
lambda_i,
ppKTP,
)
# Calculate the phase matching function
phase_matching = citrine.phase_matching_function(delta_k, grating_period, 1e-2)
# Calculate the Gaussian pump envelope
pump_envelope = citrine.pump_envelope_gaussian(lambda_p_central, sigma_p, lambda_s, lambda_i)
# Calculate the Joint Spectral Amplitude (JSA)
JSA = pump_envelope * phase_matching
# Plotting
fig, axs = plt.subplots(
2, 2, figsize=(8, 8), sharex=True, sharey=True, squeeze=True
)
# Plot Δk
axs[0, 0].pcolormesh(
lambda_i.value, lambda_s.value, delta_k, cmap='viridis'
)
axs[0, 0].set_title(r'$\Delta k$')
axs[0, 0].set_xlabel(r'$\lambda_s$ (nm)')
axs[0, 0].set_ylabel(r'$\lambda_i$ (nm)')
# Plot the pump envelope
axs[0, 1].pcolormesh(
lambda_i.value,
lambda_s.value,
pump_envelope,
cmap='viridis',
)
axs[0, 1].set_title(r'$\alpha(\lambda_s, \lambda_i)$')
axs[0, 1].set_xlabel(r'$\lambda_s$ (nm)')
axs[0, 1].set_ylabel(r'$\lambda_i$ (nm)')
# Plot the phase matching function
axs[1, 0].pcolormesh(
lambda_i.value,
lambda_s.value,
phase_matching,
cmap='viridis',
)
axs[1, 0].set_title(r'$\phi(\lambda_s, \lambda_i)$')
axs[1, 0].set_xlabel(r'$\lambda_s$ (nm)')
axs[1, 0].set_ylabel(r'$\lambda_i$ (nm)')
# Plot the Joint Spectral Amplitude (JSA)
axs[1, 1].pcolormesh(lambda_i.value, lambda_s.value, JSA, cmap='viridis')
axs[1, 1].set_title(
r'$\alpha(\lambda_s, \lambda_i) \phi(\lambda_s, \lambda_i)$'
)
axs[1, 1].set_xlabel(r'$\lambda_s$ (nm)')
axs[1, 1].set_ylabel(r'$\lambda_i$ (nm)')
# Add overall title
fig.suptitle(
r'$\omega_p = {:.2f}\mathrm{{nm}}, \omega_s = {:.2f}\mathrm{{nm}}, \omega_i = {:.2f}\mathrm{{nm}}, \Lambda = {:.2f}\mathrm{{\mu m}}$'.format(
lambda_p_central.value,
lambda_s_central.value,
lambda_i_central.value,
grating_period * (1e6), # convert to microns for printing
)
)
# Show plot
plt.tight_layout()
plt.show()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file citrinespdc-0.2.0.tar.gz.
File metadata
- Download URL: citrinespdc-0.2.0.tar.gz
- Upload date:
- Size: 62.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40e173919e88341a284753605e782dfefc8619702373350093721242b2c29c29
|
|
| MD5 |
aae48811d7aa33cfb2e2c04cd19ad806
|
|
| BLAKE2b-256 |
4f133a48c5f5cfc136285a2c059b31fe5a8047f626c0afe45f1005c289d5325c
|
Provenance
The following attestation bundles were made for citrinespdc-0.2.0.tar.gz:
Publisher:
python-publish.yml on Peter-Barrow/citrine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
citrinespdc-0.2.0.tar.gz -
Subject digest:
40e173919e88341a284753605e782dfefc8619702373350093721242b2c29c29 - Sigstore transparency entry: 220255511
- Sigstore integration time:
-
Permalink:
Peter-Barrow/citrine@8a6882bb75362cd8b1e42055692b080bb4f37e79 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Peter-Barrow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8a6882bb75362cd8b1e42055692b080bb4f37e79 -
Trigger Event:
push
-
Statement type:
File details
Details for the file citrinespdc-0.2.0-py3-none-any.whl.
File metadata
- Download URL: citrinespdc-0.2.0-py3-none-any.whl
- Upload date:
- Size: 53.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14648048eba339cf9756e9b530a7bc44659b3645a0f9fc0a5129731aa32e9900
|
|
| MD5 |
397b1e2381d2580895387f9710bcbeb0
|
|
| BLAKE2b-256 |
0d18d6de6570b92915315ee10b5670b4cbcb51579d31cb38aa32bcd816eabea1
|
Provenance
The following attestation bundles were made for citrinespdc-0.2.0-py3-none-any.whl:
Publisher:
python-publish.yml on Peter-Barrow/citrine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
citrinespdc-0.2.0-py3-none-any.whl -
Subject digest:
14648048eba339cf9756e9b530a7bc44659b3645a0f9fc0a5129731aa32e9900 - Sigstore transparency entry: 220255512
- Sigstore integration time:
-
Permalink:
Peter-Barrow/citrine@8a6882bb75362cd8b1e42055692b080bb4f37e79 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Peter-Barrow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@8a6882bb75362cd8b1e42055692b080bb4f37e79 -
Trigger Event:
push
-
Statement type: