Skip to main content

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
  • Library of crystal parameters
    • citrine.crystals sub-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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

citrinespdc-0.2.0.tar.gz (62.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

citrinespdc-0.2.0-py3-none-any.whl (53.2 kB view details)

Uploaded Python 3

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

Hashes for citrinespdc-0.2.0.tar.gz
Algorithm Hash digest
SHA256 40e173919e88341a284753605e782dfefc8619702373350093721242b2c29c29
MD5 aae48811d7aa33cfb2e2c04cd19ad806
BLAKE2b-256 4f133a48c5f5cfc136285a2c059b31fe5a8047f626c0afe45f1005c289d5325c

See more details on using hashes here.

Provenance

The following attestation bundles were made for citrinespdc-0.2.0.tar.gz:

Publisher: python-publish.yml on Peter-Barrow/citrine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for citrinespdc-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14648048eba339cf9756e9b530a7bc44659b3645a0f9fc0a5129731aa32e9900
MD5 397b1e2381d2580895387f9710bcbeb0
BLAKE2b-256 0d18d6de6570b92915315ee10b5670b4cbcb51579d31cb38aa32bcd816eabea1

See more details on using hashes here.

Provenance

The following attestation bundles were made for citrinespdc-0.2.0-py3-none-any.whl:

Publisher: python-publish.yml on Peter-Barrow/citrine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page