Loading etl/assets/commons/__init__.py +37 −0 Changes for etl/assets/commons/__init__.py: 37 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -110,6 +110,10 @@ def convert_dvelocity_to_hz(dvelocity, rest_frequencies): return dvelocity / speed_of_light.to(u.km / u.s) * rest_frequencies[0].to(u.Hz) def convert_dfreq_to_velocity(dfrequency, rest_frequencies): return dfrequency / rest_frequencies[0].to(u.Hz) * speed_of_light.to(u.km / u.s) def get_cube(filename, datadir, frequency_limits=None, smooth_data=False): cube = pyspeckit.Cube(os.path.join(datadir, filename), format='fits') if smooth_data is True: Loading @@ -135,3 +139,36 @@ def fill_guesses(line_peak, doppler_adjusted_frequencies, shift_hz, linewidth_gu freq.to(u.Hz).value + shift_hz, linewidth_guess_hz] return guesses def load_velocities_and_linewidths_from_fit(species: str, source: str, velocity_indices: dict, linewidth_indices: dict, rms: float, detection_index: dict) -> Tuple[np.ndarray, np.ndarray]: """ Load velocities, linewidths, and detection mask from a pickle file containing fitting results. Parameters ---------- species : str The species for which the data is being loaded. source : str The source identifier for the data file. velocity_indices : dict A dictionary mapping species names to tuples of indices for velocity data. linewidth_indices : dict A dictionary mapping species names to tuples of indices for linewidth data. rms : float The rms noise level of the data. detection_index : dict A dictionary mapping species names to the index to be used to create a detection mask. Returns ------- tuple of np.ndarray A tuple containing three numpy arrays: the first with the velocity data, the second with the linewidth data, and the last with the detection mask for the specified species and source. """ with open(f"final_results_{source}_{species}.pickle", "rb") as infile: fit_results = pickle.load(infile) return (fit_results[velocity_indices[species], :, :], fit_results[linewidth_indices[species], :, :], (fit_results[detection_index[species], :, :] >= 3 * rms)) etl/config/ch3oh_regions.yml +1 −1 Changes for etl/config/ch3oh_regions.yml: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ G14: { 'envelope_03': [288, 338, 25, 1], 'envelope_04': [328, 318, 20, 1], 'envelope_05': [185, 197, 25, 1], 'core_ch3oh_01': [251, 208, 20, 3], 'core_ch3oh_01': [251, 208, 20, 2], 'core_ch3oh_02': [301, 224, 8, 1], } G332.96: { Loading etl/config/config_visfit.yml +12 −4 Changes for etl/config/config_visfit.yml: 12 added lines, 4 removed lines. Original line number Diff line number Diff line random_seed: 333 check_clustering: True check_clustering: False colourscale: 'velocity' grid_opacity: 0.2 G332.96: { n_clusters: 5, min_velocity: -68, surface_point: [291, 216, -66.43255], plot_velocity_limits: [-70, -62], plot_species: ['N2H+','CH3OH'], plot_fwhm_limits: [0.5, 3], # plot_species: ['CH3OH',], plot_species: ['N2H+',], continuum_limits: [0.1, 1] } G28: { Loading @@ -13,7 +17,9 @@ G28: { min_velocity: -inf, surface_point: [272, 278, 79.2268463], plot_velocity_limits: [74, 81], plot_species: ['N2H+', 'CH3OH'], plot_fwhm_limits: [0.5, 5], plot_species: ['CH3OH', ], # plot_species: ['N2H+', ], continuum_limits: [0.1, 3] } G14: { Loading @@ -21,6 +27,8 @@ G14: { min_velocity: -inf, surface_point: [197, 291, 40.2304702], plot_velocity_limits: [37.5, 42], plot_species: ['N2H+', 'CH3OH'], plot_fwhm_limits: [0.5, 5], # plot_species: ['CH3OH', ], plot_species: ['N2H+', ], continuum_limits: [0.1, 10] } etl/config/guesses.yml +3 −3 Changes for etl/config/guesses.yml: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -143,9 +143,9 @@ G14: { [ 2.5e+5, ] ], core_ch3oh_01: [ [ [ 0.05, 0.07, 0.03, 0.01 ], [ 0.01, 0.02, 0.01, 0.003 ], [ 0.001, 0.002, 0.001, 0.0003 ] ], [ 0, 10.0e+5, -15.0e+6 ], [ 2.5e+5, 2.0e+5, 2.0e+6 ] [ [ 0.05, 0.07, 0.03, 0.01 ], [ 0.01, 0.02, 0.01, 0.003 ], ], [ 0, 10.0e+5, ], [ 2.5e+5, 2.0e+5, ] ], core_ch3oh_02: [ [ [ 0.06, 0.08, 0.03, 0.01 ], ], Loading etl/mdl/mdl_compute_infall_rate.py 0 → 100644 +23 −0 Changes for etl/mdl/mdl_compute_infall_rate.py: 23 added lines, 0 removed lines. Original line number Diff line number Diff line import numpy as np from astropy import units as u from astropy.constants import m_p # Computation carried out for G28 velocity_gradient = 2.96 * u.km / u.s / u.pc proj_length = 0.5 * u.pc proj_width = 0.25 * u.pc depth = 0.1 * u.pc los_angle_filament = 30 * u.deg los_angle_sheet = 45 * u.deg mean_molecular_weight = 2.33 # Kauffmann 2008 number_density = 5e4 * u.cm**-3 volume = np.pi * proj_length / np.cos(los_angle_filament) * proj_width / np.cos(los_angle_sheet) * depth mass = volume * mean_molecular_weight * m_p * number_density # \tau_{acc} = \frac{W_p}{\cos \theta} \left( \frac{\cos \theta}{V_{grad}} \frac{\cos \theta}{W_p} \right) accretion_timescale = (np.cos(los_angle_sheet) / velocity_gradient).to(u.yr) infall_rate = (mass / accretion_timescale).to(u.Msun / u.yr) # Same accretion on both sides # Along the filament it would be around one dex lower, as the velocity gradient is 0.2-0.3 km/s/pc No newline at end of file Loading
etl/assets/commons/__init__.py +37 −0 Changes for etl/assets/commons/__init__.py: 37 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -110,6 +110,10 @@ def convert_dvelocity_to_hz(dvelocity, rest_frequencies): return dvelocity / speed_of_light.to(u.km / u.s) * rest_frequencies[0].to(u.Hz) def convert_dfreq_to_velocity(dfrequency, rest_frequencies): return dfrequency / rest_frequencies[0].to(u.Hz) * speed_of_light.to(u.km / u.s) def get_cube(filename, datadir, frequency_limits=None, smooth_data=False): cube = pyspeckit.Cube(os.path.join(datadir, filename), format='fits') if smooth_data is True: Loading @@ -135,3 +139,36 @@ def fill_guesses(line_peak, doppler_adjusted_frequencies, shift_hz, linewidth_gu freq.to(u.Hz).value + shift_hz, linewidth_guess_hz] return guesses def load_velocities_and_linewidths_from_fit(species: str, source: str, velocity_indices: dict, linewidth_indices: dict, rms: float, detection_index: dict) -> Tuple[np.ndarray, np.ndarray]: """ Load velocities, linewidths, and detection mask from a pickle file containing fitting results. Parameters ---------- species : str The species for which the data is being loaded. source : str The source identifier for the data file. velocity_indices : dict A dictionary mapping species names to tuples of indices for velocity data. linewidth_indices : dict A dictionary mapping species names to tuples of indices for linewidth data. rms : float The rms noise level of the data. detection_index : dict A dictionary mapping species names to the index to be used to create a detection mask. Returns ------- tuple of np.ndarray A tuple containing three numpy arrays: the first with the velocity data, the second with the linewidth data, and the last with the detection mask for the specified species and source. """ with open(f"final_results_{source}_{species}.pickle", "rb") as infile: fit_results = pickle.load(infile) return (fit_results[velocity_indices[species], :, :], fit_results[linewidth_indices[species], :, :], (fit_results[detection_index[species], :, :] >= 3 * rms))
etl/config/ch3oh_regions.yml +1 −1 Changes for etl/config/ch3oh_regions.yml: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ G14: { 'envelope_03': [288, 338, 25, 1], 'envelope_04': [328, 318, 20, 1], 'envelope_05': [185, 197, 25, 1], 'core_ch3oh_01': [251, 208, 20, 3], 'core_ch3oh_01': [251, 208, 20, 2], 'core_ch3oh_02': [301, 224, 8, 1], } G332.96: { Loading
etl/config/config_visfit.yml +12 −4 Changes for etl/config/config_visfit.yml: 12 added lines, 4 removed lines. Original line number Diff line number Diff line random_seed: 333 check_clustering: True check_clustering: False colourscale: 'velocity' grid_opacity: 0.2 G332.96: { n_clusters: 5, min_velocity: -68, surface_point: [291, 216, -66.43255], plot_velocity_limits: [-70, -62], plot_species: ['N2H+','CH3OH'], plot_fwhm_limits: [0.5, 3], # plot_species: ['CH3OH',], plot_species: ['N2H+',], continuum_limits: [0.1, 1] } G28: { Loading @@ -13,7 +17,9 @@ G28: { min_velocity: -inf, surface_point: [272, 278, 79.2268463], plot_velocity_limits: [74, 81], plot_species: ['N2H+', 'CH3OH'], plot_fwhm_limits: [0.5, 5], plot_species: ['CH3OH', ], # plot_species: ['N2H+', ], continuum_limits: [0.1, 3] } G14: { Loading @@ -21,6 +27,8 @@ G14: { min_velocity: -inf, surface_point: [197, 291, 40.2304702], plot_velocity_limits: [37.5, 42], plot_species: ['N2H+', 'CH3OH'], plot_fwhm_limits: [0.5, 5], # plot_species: ['CH3OH', ], plot_species: ['N2H+', ], continuum_limits: [0.1, 10] }
etl/config/guesses.yml +3 −3 Changes for etl/config/guesses.yml: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -143,9 +143,9 @@ G14: { [ 2.5e+5, ] ], core_ch3oh_01: [ [ [ 0.05, 0.07, 0.03, 0.01 ], [ 0.01, 0.02, 0.01, 0.003 ], [ 0.001, 0.002, 0.001, 0.0003 ] ], [ 0, 10.0e+5, -15.0e+6 ], [ 2.5e+5, 2.0e+5, 2.0e+6 ] [ [ 0.05, 0.07, 0.03, 0.01 ], [ 0.01, 0.02, 0.01, 0.003 ], ], [ 0, 10.0e+5, ], [ 2.5e+5, 2.0e+5, ] ], core_ch3oh_02: [ [ [ 0.06, 0.08, 0.03, 0.01 ], ], Loading
etl/mdl/mdl_compute_infall_rate.py 0 → 100644 +23 −0 Changes for etl/mdl/mdl_compute_infall_rate.py: 23 added lines, 0 removed lines. Original line number Diff line number Diff line import numpy as np from astropy import units as u from astropy.constants import m_p # Computation carried out for G28 velocity_gradient = 2.96 * u.km / u.s / u.pc proj_length = 0.5 * u.pc proj_width = 0.25 * u.pc depth = 0.1 * u.pc los_angle_filament = 30 * u.deg los_angle_sheet = 45 * u.deg mean_molecular_weight = 2.33 # Kauffmann 2008 number_density = 5e4 * u.cm**-3 volume = np.pi * proj_length / np.cos(los_angle_filament) * proj_width / np.cos(los_angle_sheet) * depth mass = volume * mean_molecular_weight * m_p * number_density # \tau_{acc} = \frac{W_p}{\cos \theta} \left( \frac{\cos \theta}{V_{grad}} \frac{\cos \theta}{W_p} \right) accretion_timescale = (np.cos(los_angle_sheet) / velocity_gradient).to(u.yr) infall_rate = (mass / accretion_timescale).to(u.Msun / u.yr) # Same accretion on both sides # Along the filament it would be around one dex lower, as the velocity gradient is 0.2-0.3 km/s/pc No newline at end of file