Skip to content

Quantum Pressure #1

@Jordanbinda

Description

@Jordanbinda

import numpy as np
import pandas as pd
from scipy.optimize import curve_fit
from scipy.integrate import quad

Load the Pantheon+ dataset (after downloading it)

pantheon_data = pd.read_csv("path_to_pantheon_data.csv") # Update with actual path
z_pantheon = pantheon_data['z'] # Redshift values
mu_pantheon = pantheon_data['mu'] # Distance modulus

Define the distance modulus function

def distance_modulus(z, Omega_q, w_q):
# Calculate the luminosity distance in Mpc
dL_values = np.array([dL(z_val, Omega_q, w_q) for z_val in z])
return 5 * np.log10(dL_values) + 25 # Convert luminosity distance to distance modulus

Fit the quantum pressure model to the Pantheon+ data

popt, pcov = curve_fit(lambda z, Omega_q, w_q: distance_modulus(z, Omega_q, w_q), z_pantheon, mu_pantheon, bounds=([0.6, -1], [0.8, -0.5]))

Output the best-fit parameters

Omega_q_fit, w_q_fit = popt
print(f"Best-fit Omega_q: {Omega_q_fit}, Best-fit w_q: {w_q_fit}")

Calculate the residuals and chi-squared

mu_model = distance_modulus(z_pantheon, Omega_q_fit, w_q_fit)
residuals = mu_pantheon - mu_model
chi_squared = np.sum((residuals / pantheon_data['mu_error'])**2)
print(f"Chi-squared: {chi_squared}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions