JetBase#
- class jetset.jet_model.JetBase(cosmo=None, name='test', emitters_type='electrons', emitters_distribution='pl', emitters_distribution_log_values=False, beaming_expr='delta', jet_workplace=None, verbose=False, nu_size=500, clean_work_dir=True, geometry='spherical', **keywords)[source]#
Bases:
ModelBase jet model wrapping the jetkernel backend.
The class exposes a Python interface to configure physical parameters, emitter distributions, spectral components, and evaluation options.
Attributes Summary
Return whether adaptive electron binning is enabled for IC.
Return inverse-Compton spectral-grid size.
Return normalization mode of the emitter distribution.
Return particle Lorentz-factor grid size.
Return the emitting-region geometry.
Return jetkernel frequency-grid size.
Return maximum frequency of the model grid (Hz).
Return minimum frequency of the model grid (Hz).
Return seed-photon spectral-grid size.
Return number of sampled frequencies in Python-side evaluation.
Return visible spectral components.
Methods Summary
add_EC_component([EC_components_list, disk_type])Add one or more external-Compton related components.
add_SSC_component([state])Add a synchrotron self-Compton component.
Add default
Sum,Sync, andSSCcomponents.add_sync_component([state])Add a synchrotron component with the requested state.
Print available emitter distributions from the factory.
Print SSC integration debug information.
Print synchrotron integration debug information.
del_EC_component(EC_components_list[, disk_type])Remove one or more external-Compton related components.
del_par_from_dic(model_dic)Delete parameters listed in a model-parameter dictionary.
del_spectral_component(name)Delete a spectral component from the model.
enable_internal_absorption(comp[, nu_min, ...])Enable internal gamma-gamma absorption for a seed component.
energetic_report([verbose])Build and optionally print energetic quantities table.
eval([init, fill_SED, nu, get_model, ...])Evaluate the jet model.
eval_internal_absorption(comp[, skip_check, ...])Evaluate internal absorption for a component.
get_DL_cm([eval_model])Return luminosity distance in centimeters.
Return inverse-Compton mode label (
'on'or'off').Return inverse-Compton spectral-grid size.
get_SED_peak([peak_name, freq_range, log_log])Return SED peak from backend attributes or a frequency interval.
Return the current beaming factor from the backend.
get_component_peak([comp_name, log_log])Return peak frequency and flux for a spectral component.
Return lower emissivity bound used by backend calculations.
Return the active emitter-distribution name.
Return external-field transformation frame label.
get_flag()Return the backend STEM flag.
get_path()Return the backend working path.
Return seed-photon spectral-grid size.
get_spectral_component_by_name(name[, verbose])Return a spectral component by name.
Return spectral-component names as a list.
Return backend verbosity level.
lin_func(lin_nu, init[, phys_output, ...])Evaluate model spectrum in linear units on
lin_nu.Print the list of spectral-component names.
load_model(file_name_or_obj[, from_string])Load a serialized jet model.
make_conical_jet([R, theta_open, ...])Convert the model to a conical geometry parametrization.
plot_model([plot_obj, clean, label, comp, ...])Plot model spectral components on a
PlotSED.Disable internal absorption for a component.
sed_table([restframe])Provide the astropy table with SED spectral components
Attach standard EC size-luminosity relations for BLR and DT.
set_IC_nu_size(val)Set inverse-Compton spectral-grid size.
set_blob()Synchronize Python parameters/distributions to the backend blob.
set_emiss_lim(val)Set lower emissivity bound used by backend calculations.
set_emitters_distribution([distr, ...])Set or replace the emitter distribution used by the model.
set_emitting_region(beaming_expr, emitters_type)Configure emitting-region parameters on the backend.
Set external-field transformation frame.
Update external radiation fields on the backend.
set_flag(flag)Set the backend STEM flag used by jetkernel output helpers.
set_gamma_grid_size(val)Set particle Lorentz-factor grid size for emitters.
set_nu_grid_size(val)Set jetkernel frequency-grid size.
Set number of C threads used by the backend.
set_path(path[, clean_work_dir])Set and create the backend working path.
set_seed_nu_size(val)Set seed-photon spectral-grid size.
set_verbosity(val)Set backend verbosity level.
Print emitter-distribution settings and parameters.
Print enabled internal-absorption components and settings.
shortcut to
ModelParametersArray.show_parsmethod shows all the paramters in the modelPrint currently registered spectral components.
Enable scaling-factor normalization mode.
Enable physical-density normalization mode.
Attributes Documentation
- IC_adaptive_e_binning#
Return whether adaptive electron binning is enabled for IC.
- IC_nu_size#
Return inverse-Compton spectral-grid size.
- Norm_distr#
Return normalization mode of the emitter distribution.
- Returns:
True/1means physical-density normalization,False/0means scaling-factor normalization.- Return type:
bool or int
- gamma_grid_size#
Return particle Lorentz-factor grid size.
- geometry#
Return the emitting-region geometry.
- nu_grid_size#
Return jetkernel frequency-grid size.
- nu_max#
Return maximum frequency of the model grid (Hz).
- nu_min#
Return minimum frequency of the model grid (Hz).
- nu_seed_size#
Return seed-photon spectral-grid size.
- nu_size#
Return number of sampled frequencies in Python-side evaluation.
- spectral_components_list#
Return visible spectral components.
- Returns:
Spectral components with
hidden == False.- Return type:
list
Methods Documentation
- add_EC_component(EC_components_list=[], disk_type=None)[source]#
Add one or more external-Compton related components.
- Parameters:
EC_components_list (str or list of str, optional) – Component names to add.
'All'enables all supported EC entries.disk_type (str, optional) – Disk template type for disk-dependent EC components.
- static available_emitters_distributions()[source]#
Print available emitter distributions from the factory.
- del_EC_component(EC_components_list, disk_type='BB')[source]#
Remove one or more external-Compton related components.
- Parameters:
EC_components_list (str or list of str, optional)
disk_type (str, optional) – Disk template type for disk-dependent EC components.
- enable_internal_absorption(comp, nu_min=1e+20, N_soft=50, N_hard=50, N_R_H=50, N_theta=50, use_R_H_profile_extrapolation=False)[source]#
Enable internal gamma-gamma absorption for a seed component.
- Parameters:
comp (str) – Seed-photon component name used to compute optical depth.
nu_min (float, optional) – Minimum frequency used for the internal absorption solver (Hz).
N_soft (int, optional) – Numerical grid sizes used by the absorption solver.
N_hard (int, optional) – Numerical grid sizes used by the absorption solver.
N_R_H (int, optional) – Numerical grid sizes used by the absorption solver.
N_theta (int, optional) – Numerical grid sizes used by the absorption solver.
use_R_H_profile_extrapolation (bool, optional) – If
True, extrapolate the radial profile when required.
- eval(init=True, fill_SED=True, nu=None, get_model=False, loglog=False, plot=None, label=None, phys_output=False, update_emitters=True)[source]#
Evaluate the jet model.
Parameters are compatible with
Model.eval(), with additional control over backend initialization and emitter updates.
- eval_internal_absorption(comp, skip_check=True, peak=False)[source]#
Evaluate internal absorption for a component.
- Returns:
(tau, nu_src)if available, otherwise(None, None).- Return type:
tuple
- get_SED_peak(peak_name=None, freq_range=None, log_log=False)[source]#
Return SED peak from backend attributes or a frequency interval.
- Parameters:
peak_name (str, optional) – Backend peak attribute name (for example
'nu_p_Sync_obs').freq_range (tuple, optional) –
(nu_min, nu_max)range used to search the peak numerically.log_log (bool, optional) – If
True, return values in log10 scale.
- get_component_peak(comp_name=None, log_log=False)[source]#
Return peak frequency and flux for a spectral component.
- get_spectral_component_by_name(name, verbose=True)[source]#
Return a spectral component by name.
- Parameters:
name (str) – Component name.
verbose (bool, optional) – If
True, print available names when not found.
- Returns:
Matching component, or
Noneif missing.- Return type:
JetSpecComponent or None
- lin_func(lin_nu, init, phys_output=False, update_emitters=True)[source]#
Evaluate model spectrum in linear units on
lin_nu.Applies internal absorption (if enabled) and returns the total model after hidden components are removed.
- classmethod load_model(file_name_or_obj, from_string=False)[source]#
Load a serialized jet model.
- Parameters:
file_name_or_obj (str or bytes or file-like) – Serialized model source accepted by the internal pickle loader.
from_string (bool, optional) – If
True, interpretfile_name_or_objas in-memory content instead of a filesystem path.
- Returns:
Reconstructed model with backend state refreshed via
set_blob.- Return type:
- make_conical_jet(R=None, theta_open=5.0, theta_open_min=1, theta_open_max=10)[source]#
Convert the model to a conical geometry parametrization.
The method introduces a user parameter
theta_openand setsR = tan(theta_open) * R_Has a dependent parameter relation.- Parameters:
R (float, optional) – Target region size used to initialize
R_Hafter linking. If omitted, the currentRvalue is used.theta_open (float, optional) – Semi-opening angle in degrees.
theta_open_min (int, optional) – Lower bound for
theta_open.theta_open_max (int, optional) – Upper bound for
theta_open.
- Raises:
RuntimeError – If dependency setup fails (for example because parameters already exist with incompatible dependency state).
- plot_model(plot_obj=None, clean=False, label=None, comp=None, sed_data=None, color=None, auto_label=True, line_style='-', frame='obs', density=False)[source]#
Plot model spectral components on a
PlotSED.- Parameters:
plot_obj (jetset.plot_sedfit.PlotSED, optional) – Existing plot object. If omitted, a new one is created.
clean (bool, optional) – If
True, remove previously plotted model lines before adding new ones.label (str, optional) – Label to use for the plotted line(s). If not provided, component names are used when
auto_label=True.comp (str, optional) – Name of a single spectral component to plot. If omitted, all active components plus
Sumare plotted.sed_data (jetset.data_loader.ObsData, optional) – Observational data to add to the same plot.
color (str, optional) – Matplotlib color for model line(s).
auto_label (bool, optional) – If
True, automatically derive labels from component names.line_style (str, optional) – Line style used for non-sum components.
frame ({"obs", "src", "blob"}, optional) – Output frame used for plotting.
density (bool, optional) – If
True, plot density representation.
- Returns:
Plot object with added model traces.
- Return type:
- sed_table(restframe='obs')[source]#
Provide the astropy table with SED spectral components
- Parameters:
restframe (str, optional) – , by default ‘obs’
- Return type:
astropy table
- set_EC_dependencies()[source]#
Attach standard EC size-luminosity relations for BLR and DT.
When disk parameters are available, this sets dependent-parameter expressions for
R_BLR_in,R_BLR_out, andR_DTas functions ofL_Disk.
- set_emitters_distribution(distr=None, log_values=False, emitters_type='electrons', init=True)[source]#
Set or replace the emitter distribution used by the model.
This method supports analytic distributions (by name), array-based distributions, and injection distributions for leptonic-equilibrium mode. It updates Jet parameters and backend bindings accordingly.
- Parameters:
distr (str or EmittersDistribution or ArrayDistribution or InjEmittersDistribution) – Distribution specification.
log_values (bool, optional) – If
True, interpret analytic distribution parameters in log space.emitters_type (str, optional) – Emitter type used when creating distributions from names/arrays.
init (bool, optional) – If
True, initialize backend state before replacing the distribution.
- set_emitting_region(beaming_expr, emitters_type)[source]#
Configure emitting-region parameters on the backend.
- Parameters:
beaming_expr (str) – Beaming parametrization used to build region parameters.
emitters_type (str) – Emitter family used to select the corresponding parameter set.
- set_external_field_transf(val)[source]#
Set external-field transformation frame.
- Parameters:
val (str) – Allowed values are
'blob'and'disk'.
- show_internal_absorption_components()[source]#
Print enabled internal-absorption components and settings.