Commit 1cbd97ed authored by Andrea Giannetti's avatar Andrea Giannetti
Browse files

Added seaborn to requirements.txt to produce density plots automatically.

parent 63dd7475
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
import matplotlib.pyplot as plt
import numpy as np
import os

import seaborn as sns
import pandas as pd
import xarray as xr
from typing import Union, Tuple
@@ -66,7 +66,7 @@ def get_results(
        session: Session,
        is_isothermal: bool = False) -> Tuple[float, str, str, tuple, np.array]:
    """
    Get results from the database, given the prameters of the model
    Get results from the database, given the parameters of the model
    :param dust_temperature: the characteristic dust temperature
    :param gas_density: the characteristic number density of molecualar hydrogen
    :param lines: the lines used to compute the ratio
@@ -236,6 +236,10 @@ def main(run_id: str,
        df_tmp['tdust'] = tdust
        df_list_concat.append(df_tmp)
    df_all = pd.concat(df_list_concat)
    for lines in line_pairs:
        sns.kdeplot(x=np.log10(df_all['avg_nh2']), y=df_all[f'ratio_{"-".join(lines)}'], bw_adjust=2)
        plt.savefig(os.path.join('prs', 'output', f'ratio_vs_avg_density_los_kde_{"-".join(lines)}.png'))
        plt.clf()
    df_all.to_csv('full_dataset.csv')


+2 −1
Original line number Diff line number Diff line
@@ -7,3 +7,4 @@ tqdm==4.64.1
xarray==2022.10.0
sqlalchemy==1.4.42
psycopg2-binary==2.9.5
seaborn==0.12.1
 No newline at end of file