JetBase

Contents

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: Model

Base 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

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.

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.

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_basic_components()

Add default Sum, Sync, and SSC components.

add_sync_component([state])

Add a synchrotron component with the requested state.

available_emitters_distributions()

Print available emitter distributions from the factory.

debug_SSC()

Print SSC integration debug information.

debug_synch()

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.

get_IC_mode()

Return inverse-Compton mode label ('on' or 'off').

get_IC_nu_size()

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.

get_beaming()

Return the current beaming factor from the backend.

get_component_peak([comp_name, log_log])

Return peak frequency and flux for a spectral component.

get_emiss_lim()

Return lower emissivity bound used by backend calculations.

get_emitters_distribution_name()

Return the active emitter-distribution name.

get_external_field_transf()

Return external-field transformation frame label.

get_flag()

Return the backend STEM flag.

get_path()

Return the backend working path.

get_seed_nu_size()

Return seed-photon spectral-grid size.

get_spectral_component_by_name(name[, verbose])

Return a spectral component by name.

get_spectral_component_names_list()

Return spectral-component names as a list.

get_verbosity()

Return backend verbosity level.

lin_func(lin_nu, init[, phys_output, ...])

Evaluate model spectrum in linear units on lin_nu.

list_spectral_components()

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.

remove_internal_absorption(comp)

Disable internal absorption for a component.

sed_table([restframe])

Provide the astropy table with SED spectral components

set_EC_dependencies()

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_transf(val)

Set external-field transformation frame.

set_external_fields()

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_num_c_threads(N)

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.

show_emitters_distribution()

Print emitter-distribution settings and parameters.

show_internal_absorption_components()

Print enabled internal-absorption components and settings.

show_model()

shortcut to ModelParametersArray.show_pars method shows all the paramters in the model

show_spectral_components()

Print currently registered spectral components.

switch_Norm_distr_OFF()

Enable scaling-factor normalization mode.

switch_Norm_distr_ON()

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/1 means physical-density normalization, False/0 means 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.

add_SSC_component(state='on')[source]#

Add a synchrotron self-Compton component.

add_basic_components()[source]#

Add default Sum, Sync, and SSC components.

add_sync_component(state='self-abs')[source]#

Add a synchrotron component with the requested state.

static available_emitters_distributions()[source]#

Print available emitter distributions from the factory.

debug_SSC()[source]#

Print SSC integration debug information.

debug_synch()[source]#

Print synchrotron integration debug information.

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.

del_par_from_dic(model_dic)[source]#

Delete parameters listed in a model-parameter dictionary.

del_spectral_component(name)[source]#

Delete a spectral component from the model.

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.

energetic_report(verbose=True)[source]#

Build and optionally print energetic quantities table.

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_DL_cm(eval_model=False)[source]#

Return luminosity distance in centimeters.

get_IC_mode()[source]#

Return inverse-Compton mode label ('on' or 'off').

get_IC_nu_size()[source]#

Return inverse-Compton spectral-grid size.

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_beaming()[source]#

Return the current beaming factor from the backend.

get_component_peak(comp_name=None, log_log=False)[source]#

Return peak frequency and flux for a spectral component.

get_emiss_lim()[source]#

Return lower emissivity bound used by backend calculations.

get_emitters_distribution_name()[source]#

Return the active emitter-distribution name.

get_external_field_transf()[source]#

Return external-field transformation frame label.

get_flag()[source]#

Return the backend STEM flag.

get_path()[source]#

Return the backend working path.

get_seed_nu_size()[source]#

Return seed-photon spectral-grid size.

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 None if missing.

Return type:

JetSpecComponent or None

get_spectral_component_names_list()[source]#

Return spectral-component names as a list.

get_verbosity()[source]#

Return backend verbosity level.

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.

list_spectral_components()[source]#

Print the list of spectral-component names.

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, interpret file_name_or_obj as in-memory content instead of a filesystem path.

Returns:

Reconstructed model with backend state refreshed via set_blob.

Return type:

JetBase

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_open and sets R = tan(theta_open) * R_H as a dependent parameter relation.

Parameters:
  • R (float, optional) – Target region size used to initialize R_H after linking. If omitted, the current R value 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 Sum are 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:

jetset.plot_sedfit.PlotSED

remove_internal_absorption(comp)[source]#

Disable internal absorption for a component.

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, and R_DT as functions of L_Disk.

set_IC_nu_size(val)[source]#

Set inverse-Compton spectral-grid size.

set_blob()[source]#

Synchronize Python parameters/distributions to the backend blob.

set_emiss_lim(val)[source]#

Set lower emissivity bound used by backend calculations.

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'.

set_external_fields()[source]#

Update external radiation fields on the backend.

set_flag(flag)[source]#

Set the backend STEM flag used by jetkernel output helpers.

set_gamma_grid_size(val)[source]#

Set particle Lorentz-factor grid size for emitters.

set_nu_grid_size(val)[source]#

Set jetkernel frequency-grid size.

set_num_c_threads(N)[source]#

Set number of C threads used by the backend.

set_path(path, clean_work_dir=True)[source]#

Set and create the backend working path.

set_seed_nu_size(val)[source]#

Set seed-photon spectral-grid size.

set_verbosity(val)[source]#

Set backend verbosity level.

show_emitters_distribution()[source]#

Print emitter-distribution settings and parameters.

show_internal_absorption_components()[source]#

Print enabled internal-absorption components and settings.

show_model()[source]#

shortcut to ModelParametersArray.show_pars method shows all the paramters in the model

show_spectral_components()[source]#

Print currently registered spectral components.

switch_Norm_distr_OFF()[source]#

Enable scaling-factor normalization mode.

switch_Norm_distr_ON()[source]#

Enable physical-density normalization mode.