from .ConstantsAndParameters import *

# useful functions
def w2f(wlen):
    return c0/wlen # returns the frequency [Hz] \\tfrom the wavelength [m]

def f2w(freq):
    return c0/freq # returns the wavelength [m] \\tfrom the frequency [Hz]

def print_const(normalized = False):
    if not normalized:
        print("CONSTANTS and PARAMETERS")
        print()
        print("general physics constants")
        print("ε0\t= %.8e"%ε0, "[F/m] \tvacuum permittivity")
        print("c0\t= %d"%c0, "[m/s] \tspeed of light in vacuum")
        print("ħ\t= %.8e"%ħ, "[J*s] \tPlanck constant")
        print()
        print("geometrical parameters")
        print("R\t= %.2e"%R, "[m ] \tradius")
        print("w\t= %.2e"%w, "[m ] \twidth")
        print("h\t= %.2e"%h, "[m ] \theight")
        print("wga\t= %.2e"%wga, "[m²] \tcore area")
        print()
        print("L\t= %.4e"%L, "[m ] \tcore length")
        print("V\t= %.4e"%V, "[m³] \tcore volume")
        print()
        print("EM field parameters")
        print("λ0\t= %.4e"%λ0, "[m] \tstandard wavelength")
        print("ω0\t= %.4e"%ω0, "[Hz] \tstandard frequency")
        print()
        print("Silicon physical parameters")
        print("ρSi\t= %.4e"%ρSi, "[kg/m³] \tSilicon density")
        print("Cp\t= %.2e"%Cp, "[J/kg/K] \tSilicon specific heat at constant pressure")
        print("MCpV\t= %.3e"%MCpV, "[J/K/m³] \tMring*Cp")
        print()
        print("𝛾TH\t= %.3e"%𝛾TH, "[Hz] \tphenomenological heat loss rate")
        print("𝛾FC\t= %.3e"%𝛾FC, "[Hz] \tphenomenological free carrier population loss rate")
        print()
        print("nSi\t= %.3f"%nSi, "[1] \t\tSilicon refractive index")
        print("n0\t= %.3f"%n0, "[1] \t\tdefault system refractive index")
        print("n2\t= %.3e"%n2, "[m²/W] \tSilicon intensity dependent refractive index")
        print("dndT\t= %.3e"%dndT, "[1/K] \tSilicon refractive index expansion term in temperature")
        print("dndN\t= %.3e"%dndN, "[m³] \tSilicon refractive index real expansion term in free carrier population")
        print("dαdN\t= %.3e"%dαdN, "[m²] \tSilicon refractive index imaginary expansion term in free carrier population")
        print("βtpa\t= %.3e"%βtpa, "[m/W] \tSilicon TPA coefficient")
        print()
        print("Coupling parameters")
        print("ĸ\t= %.2f"%κ, "[1] \t\tfirst coupling constant")
        print("𝛾\t= %.2f"%𝛾, "[1] \t\thalf round-trip power loss factor")
    else:
        print("CONSTANTS and PARAMETERS")
        print()
        print("general physics constants* (*not-normalized)")
#        print("ε0\t= %.8e"%ε0, "[F/m] \tvacuum permittivity")
        print("ñc0\t= %.9f"%ñc0, "[µm*PHz] \tspeed of light in vacuum ([µm/fs])")
        print("ñħ\t= %.8f"%ñħ, "[mW/PHz²] \tPlanck constant")
        print()
        print("geometrical parameters")
        print("R\t= %.5f"%ñR, "[µm ] \tradius")
        print("w\t= %.5f"%ñw, "[µm ] \twidth")
        print("h\t= %.5f"%ñh, "[µm ] \theight")
        print("wga\t= %.5f"%ñwga, "[µm²] \tcore area")
        print()
        print("L\t= %.5f"%ñL, "[µm ] \tcore length")
        print("V\t= %.5f"%ñV, "[µm³] \tcore volume")
        print()
        print("EM field parameters")
        print("λ0\t= %.5f"%ñλ0, "[µm] \t\tresonance wavelength")
        print("ω0\t= %.5f"%ñω0, "[PHz] \t\tresonance frequency")
        print()
        print("Silicon physical parameters")
        print("MCpV\t= %.3e"%ñMCpV, "[mW/PHz/K/µm³] \tMring*Cp/V")
        print()
        print("𝛾TH\t= %.3e"%ñ𝛾TH, "[PHz] \tphenomenological heat loss rate")
        print("𝛾FC\t= %.3e"%ñ𝛾FC, "[PHz] \tphenomenological free carrier population loss rate")
        print()
        print("nSi\t= %.3f"%nSi, "[1] \t\tSilicon refractive index")
        print("n0\t= %.3f"%ñn0, "[1] \t\tdefault system refractive index")
        print("n2\t= %.3e"%ñn2, "[µm²/mW] \tSilicon intensity dependent refractive index")
        print("dndT\t= %.3e"%ñdndT, "[1/K] \tSilicon refractive index expansion term in temperature")
        print("dndN\t= %.3e"%ñdndN, "[µm³] \tSilicon refractive index real expansion term in free carrier population")
        print("dαdN\t= %.3e"%ñdαdN, "[µm²] \tSilicon refractive index imaginary expansion term in free carrier population")
        print("βtpa\t= %.3e"%ñβtpa, "[µm/mW] \tSilicon TPA coefficient")
        print()
        print("Coupling parameters")
        print("ĸ\t= %.2f"%κ, "[1] \t\tfirst coupling constant")
        print("𝛾\t= %.2f"%𝛾, "[1] \t\thalf round-trip power loss factor")

from .ConstantsAndParameters import *

# useful functions
def w2f(wlen):
    return c0/wlen # returns the frequency [Hz] \\tfrom the wavelength [m]

def f2w(freq):
    return c0/freq # returns the wavelength [m] \\tfrom the frequency [Hz]

def print_const(normalized = False):
    if not normalized:
        print("CONSTANTS and PARAMETERS")
        print()
        print("general physics constants")
        print("ε0\t= %.8e"%ε0, "[F/m] \tvacuum permittivity")
        print("c0\t= %d"%c0, "[m/s] \tspeed of light in vacuum")
        print("ħ\t= %.8e"%ħ, "[J*s] \tPlanck constant")
        print()
        print("geometrical parameters")
        print("R\t= %.2e"%R, "[m ] \tradius")
        print("w\t= %.2e"%w, "[m ] \twidth")
        print("h\t= %.2e"%h, "[m ] \theight")
        print("wga\t= %.2e"%wga, "[m²] \tcore area")
        print()
        print("L\t= %.4e"%L, "[m ] \tcore length")
        print("V\t= %.4e"%V, "[m³] \tcore volume")
        print()
        print("EM field parameters")
        print("λ0\t= %.4e"%λ0, "[m] \tstandard wavelength")
        print("ω0\t= %.4e"%ω0, "[Hz] \tstandard frequency")
        print()
        print("Silicon physical parameters")
        print("ρSi\t= %.4e"%ρSi, "[kg/m³] \tSilicon density")
        print("Cp\t= %.2e"%Cp, "[J/kg/K] \tSilicon specific heat at constant pressure")
        print("MCpV\t= %.3e"%MCpV, "[J/K/m³] \tMring*Cp")
        print()
        print("𝛾TH\t= %.3e"%𝛾TH, "[Hz] \tphenomenological heat loss rate")
        print("𝛾FC\t= %.3e"%𝛾FC, "[Hz] \tphenomenological free carrier population loss rate")
        print()
        print("nSi\t= %.3f"%nSi, "[1] \t\tSilicon refractive index")
        print("n0\t= %.3f"%n0, "[1] \t\tdefault system refractive index")
        print("n2\t= %.3e"%n2, "[m²/W] \tSilicon intensity dependent refractive index")
        print("dndT\t= %.3e"%dndT, "[1/K] \tSilicon refractive index expansion term in temperature")
        print("dndN\t= %.3e"%dndN, "[m³] \tSilicon refractive index real expansion term in free carrier population")
        print("dαdN\t= %.3e"%dαdN, "[m²] \tSilicon refractive index imaginary expansion term in free carrier population")
        print("βtpa\t= %.3e"%βtpa, "[m/W] \tSilicon TPA coefficient")
        print()
        print("Coupling parameters")
        print("ĸ\t= %.2f"%κ, "[1] \t\tfirst coupling constant")
        print("𝛾\t= %.2f"%𝛾, "[1] \t\thalf round-trip power loss factor")
    else:
        print("CONSTANTS and PARAMETERS")
        print()
        print("general physics constants* (*not-normalized)")
#        print("ε0\t= %.8e"%ε0, "[F/m] \tvacuum permittivity")
        print("ñc0\t= %.9f"%ñc0, "[µm*PHz] \tspeed of light in vacuum ([µm/fs])")
        print("ñħ\t= %.8f"%ñħ, "[mW/PHz²] \tPlanck constant")
        print()
        print("geometrical parameters")
        print("R\t= %.5f"%ñR, "[µm ] \tradius")
        print("w\t= %.5f"%ñw, "[µm ] \twidth")
        print("h\t= %.5f"%ñh, "[µm ] \theight")
        print("wga\t= %.5f"%ñwga, "[µm²] \tcore area")
        print()
        print("L\t= %.5f"%ñL, "[µm ] \tcore length")
        print("V\t= %.5f"%ñV, "[µm³] \tcore volume")
        print()
        print("EM field parameters")
        print("λ0\t= %.5f"%ñλ0, "[µm] \t\tresonance wavelength")
        print("ω0\t= %.5f"%ñω0, "[PHz] \t\tresonance frequency")
        print()
        print("Silicon physical parameters")
        print("MCpV\t= %.3e"%ñMCpV, "[mW/PHz/K/µm³] \tMring*Cp/V")
        print()
        print("𝛾TH\t= %.3e"%ñ𝛾TH, "[PHz] \tphenomenological heat loss rate")
        print("𝛾FC\t= %.3e"%ñ𝛾FC, "[PHz] \tphenomenological free carrier population loss rate")
        print()
        print("nSi\t= %.3f"%nSi, "[1] \t\tSilicon refractive index")
        print("n0\t= %.3f"%ñn0, "[1] \t\tdefault system refractive index")
        print("n2\t= %.3e"%ñn2, "[µm²/mW] \tSilicon intensity dependent refractive index")
        print("dndT\t= %.3e"%ñdndT, "[1/K] \tSilicon refractive index expansion term in temperature")
        print("dndN\t= %.3e"%ñdndN, "[µm³] \tSilicon refractive index real expansion term in free carrier population")
        print("dαdN\t= %.3e"%ñdαdN, "[µm²] \tSilicon refractive index imaginary expansion term in free carrier population")
        print("βtpa\t= %.3e"%ñβtpa, "[µm/mW] \tSilicon TPA coefficient")
        print()
        print("Coupling parameters")
        print("ĸ\t= %.2f"%κ, "[1] \t\tfirst coupling constant")
        print("𝛾\t= %.2f"%𝛾, "[1] \t\thalf round-trip power loss factor")

# useful functions # returns the frequency [Hz] \\tfrom the wavelength [m] # returns the wavelength [m] \\tfrom the frequency [Hz] #        print("ε0\t= %.8e"%ε0, "[F/m] \tvacuum permittivity")