pisa package
Subpackages
- pisa.analysis package
- pisa.core package
- Submodules
- pisa.core.bin_indexing module
- pisa.core.binning module
MultiDimBinning
MultiDimBinning.assert_array_fits()
MultiDimBinning.assert_compat()
MultiDimBinning.basename_binning
MultiDimBinning.basenames
MultiDimBinning.bin_edges
MultiDimBinning.bin_volumes()
MultiDimBinning.broadcast()
MultiDimBinning.broadcaster()
MultiDimBinning.coord
MultiDimBinning.dimensions
MultiDimBinning.dims
MultiDimBinning.domains
MultiDimBinning.downsample()
MultiDimBinning.edges_hash
MultiDimBinning.empty()
MultiDimBinning.finite_binning
MultiDimBinning.from_json()
MultiDimBinning.full()
MultiDimBinning.hash
MultiDimBinning.hashable_state
MultiDimBinning.inbounds_criteria
MultiDimBinning.index()
MultiDimBinning.index2coord()
MultiDimBinning.indexer()
MultiDimBinning.is_compat()
MultiDimBinning.is_irregular
MultiDimBinning.is_lin
MultiDimBinning.is_log
MultiDimBinning.iterbins()
MultiDimBinning.itercoords()
MultiDimBinning.iterdims()
MultiDimBinning.iteredgetuples()
MultiDimBinning.ito()
MultiDimBinning.mask
MultiDimBinning.mask_hash
MultiDimBinning.meshgrid()
MultiDimBinning.midpoints
MultiDimBinning.name
MultiDimBinning.names
MultiDimBinning.normalize_values
MultiDimBinning.normalized_state
MultiDimBinning.num_bins
MultiDimBinning.num_dims
MultiDimBinning.ones()
MultiDimBinning.oversample()
MultiDimBinning.remove()
MultiDimBinning.reorder_dimensions()
MultiDimBinning.serializable_state
MultiDimBinning.shape
MultiDimBinning.size
MultiDimBinning.slice()
MultiDimBinning.squeeze()
MultiDimBinning.to()
MultiDimBinning.to_json()
MultiDimBinning.tot_num_bins
MultiDimBinning.units
MultiDimBinning.weighted_bin_volumes()
MultiDimBinning.weighted_centers
MultiDimBinning.zeros()
OneDimBinning
OneDimBinning.assert_compat()
OneDimBinning.basename
OneDimBinning.basename_binning
OneDimBinning.bin_edges
OneDimBinning.bin_names
OneDimBinning.bin_widths
OneDimBinning.domain
OneDimBinning.downsample()
OneDimBinning.edge_magnitudes
OneDimBinning.edges_hash
OneDimBinning.finite_binning
OneDimBinning.from_json()
OneDimBinning.hash
OneDimBinning.hashable_state
OneDimBinning.inbounds_criteria
OneDimBinning.index()
OneDimBinning.is_bin_spacing_lin_uniform()
OneDimBinning.is_bin_spacing_log_uniform()
OneDimBinning.is_binning_ok()
OneDimBinning.is_compat()
OneDimBinning.is_irregular
OneDimBinning.is_lin
OneDimBinning.is_log
OneDimBinning.iterbins()
OneDimBinning.iteredgetuples()
OneDimBinning.ito()
OneDimBinning.label
OneDimBinning.midpoints
OneDimBinning.name
OneDimBinning.normalize_values
OneDimBinning.normalized_state
OneDimBinning.num_bins
OneDimBinning.oversample()
OneDimBinning.range
OneDimBinning.rehash()
OneDimBinning.serializable_state
OneDimBinning.shape
OneDimBinning.size
OneDimBinning.tex
OneDimBinning.to()
OneDimBinning.to_json()
OneDimBinning.units
OneDimBinning.weighted_bin_widths
OneDimBinning.weighted_centers
basename()
is_binning()
test_MultiDimBinning()
test_OneDimBinning()
- pisa.core.container module
Container
Container.all_keys
Container.all_keys_incl_aux_data
Container.array_representations
Container.array_to_binned()
Container.auto_translate()
Container.binned_to_array()
Container.default_translation_mode
Container.find_valid_representation()
Container.get_hist()
Container.get_map()
Container.is_map
Container.keys
Container.keys_incl_aux_data
Container.mark_changed()
Container.mark_valid()
Container.num_dims
Container.representation
Container.representation_keys
Container.representations
Container.resample()
Container.set_aux_data()
Container.shape
Container.size
Container.translate()
Container.translation_modes
Container.unroll_binning()
ContainerSet
VirtualContainer
test_container()
test_container_set()
- pisa.core.detectors module
Detectors
Detectors.distribution_makers
Detectors.empty_bin_indices
Detectors.get_outputs()
Detectors.hash
Detectors.init_params()
Detectors.num_events_per_bin
Detectors.param_selections
Detectors.params
Detectors.profile
Detectors.randomize_free_params()
Detectors.report_profile()
Detectors.reset_all()
Detectors.reset_free()
Detectors.run()
Detectors.select_params()
Detectors.set_free_params()
Detectors.set_nominal_by_current_values()
Detectors.setup()
Detectors.shared_param_ind_list
Detectors.source_code_hash
Detectors.tabulate()
Detectors.update_params()
main()
parse_args()
test_Detectors()
- pisa.core.distribution_maker module
DistributionMaker
DistributionMaker.add_covariance()
DistributionMaker.empty_bin_indices
DistributionMaker.get_outputs()
DistributionMaker.hash
DistributionMaker.num_events_per_bin
DistributionMaker.param_selections
DistributionMaker.params
DistributionMaker.pipelines
DistributionMaker.profile
DistributionMaker.randomize_free_params()
DistributionMaker.report_profile()
DistributionMaker.reset_all()
DistributionMaker.reset_free()
DistributionMaker.run()
DistributionMaker.select_params()
DistributionMaker.set_free_params()
DistributionMaker.set_nominal_by_current_values()
DistributionMaker.setup()
DistributionMaker.source_code_hash
DistributionMaker.tabulate()
DistributionMaker.update_params()
main()
parse_args()
test_DistributionMaker()
- pisa.core.events module
- pisa.core.events_pi module
- pisa.core.map module
Map
Map.allclose()
Map.assert_compat()
Map.barlow_llh()
Map.binning
Map.chi2()
Map.compare()
Map.conv_llh()
Map.correct_chi2()
Map.downsample()
Map.fluctuate()
Map.from_json()
Map.full_comparison
Map.generalized_poisson_llh()
Map.hash
Map.hashable_state
Map.hist
Map.item()
Map.iterbins()
Map.itercoords()
Map.llh()
Map.log()
Map.log10()
Map.mcllh_eff()
Map.mcllh_mean()
Map.metric_total()
Map.mod_chi2()
Map.name
Map.nominal_values
Map.normalize_values
Map.num_entries
Map.plot()
Map.project()
Map.rebin()
Map.reorder_dimensions()
Map.round2int()
Map.serializable_state
Map.set_errors()
Map.set_poisson_errors()
Map.shape
Map.signed_sqrt_mod_chi2()
Map.size
Map.slice()
Map.split()
Map.sqrt()
Map.squeeze()
Map.std_devs
Map.sum()
Map.tex
Map.to_json()
MapSet
MapSet.allclose()
MapSet.apply_to_maps()
MapSet.chi2_per_map()
MapSet.chi2_total()
MapSet.collate_with_names()
MapSet.combine_re()
MapSet.combine_wildcard()
MapSet.compare()
MapSet.downsample()
MapSet.find_map()
MapSet.fluctuate()
MapSet.from_json()
MapSet.hash
MapSet.hash_maps()
MapSet.hashes
MapSet.index()
MapSet.llh_per_map()
MapSet.llh_total()
MapSet.log()
MapSet.log10()
MapSet.metric_per_map()
MapSet.metric_total()
MapSet.name
MapSet.names
MapSet.plot()
MapSet.pop()
MapSet.project()
MapSet.rebin()
MapSet.reorder_dimensions()
MapSet.serializable_state
MapSet.set_poisson_errors()
MapSet.sqrt()
MapSet.squeeze()
MapSet.sum()
MapSet.to_json()
rebin()
reduceToHist()
test_Map()
test_MapSet()
type_error()
valid_nominal_values()
- pisa.core.param module
DerivedParam
Param
Param.dimensionality
Param.from_json()
Param.hash
Param.ito()
Param.m
Param.m_as()
Param.magnitude
Param.nominal_value
Param.prior
Param.prior_chi2
Param.prior_llh
Param.prior_penalty()
Param.randomize()
Param.range
Param.reset()
Param.serializable_state
Param.set_nominal_to_current_value()
Param.state
Param.tex
Param.to()
Param.to_json()
Param.u
Param.units
Param.validate_value()
Param.value
ParamSelector
ParamSet
ParamSet.add_covariance()
ParamSet.are_discrete
ParamSet.are_fixed
ParamSet.continuous
ParamSet.discrete
ParamSet.extend()
ParamSet.fix()
ParamSet.fixed
ParamSet.free
ParamSet.from_json()
ParamSet.has_derived
ParamSet.hash
ParamSet.index()
ParamSet.insert()
ParamSet.is_nominal
ParamSet.issubset()
ParamSet.issuperset()
ParamSet.name_val_dict
ParamSet.names
ParamSet.nominal_values
ParamSet.nominal_values_hash
ParamSet.priors
ParamSet.priors_chi2
ParamSet.priors_llh
ParamSet.priors_penalties()
ParamSet.priors_penalty()
ParamSet.randomize_free()
ParamSet.ranges
ParamSet.replace()
ParamSet.reset_all()
ParamSet.reset_free()
ParamSet.serializable_state
ParamSet.set_nominal_by_current_values()
ParamSet.set_values()
ParamSet.state
ParamSet.tabulate()
ParamSet.tex
ParamSet.to_json()
ParamSet.unfix()
ParamSet.update()
ParamSet.update_existing()
ParamSet.values
ParamSet.values_hash
test_Param()
test_ParamSelector()
test_ParamSet()
- pisa.core.pipeline module
Pipeline
Pipeline.add_covariance()
Pipeline.config
Pipeline.get_outputs()
Pipeline.hash
Pipeline.index()
Pipeline.param_selections
Pipeline.params
Pipeline.profile
Pipeline.report_profile()
Pipeline.run()
Pipeline.select_params()
Pipeline.setup()
Pipeline.source_code_hash
Pipeline.stage_names
Pipeline.stages
Pipeline.tabulate()
Pipeline.update_params()
main()
parse_args()
test_Pipeline()
- pisa.core.prior module
- pisa.core.stage module
Stage
Stage.apply()
Stage.apply_function()
Stage.apply_mode
Stage.calc_mode
Stage.compute()
Stage.compute_function()
Stage.data
Stage.debug_mode
Stage.error_method
Stage.expected_container_keys
Stage.expected_params
Stage.full_hash
Stage.hash
Stage.in_standalone_mode
Stage.include_attrs_for_hashes()
Stage.is_map
Stage.param_hash
Stage.param_selections
Stage.params
Stage.profile
Stage.report_profile()
Stage.run()
Stage.select_params()
Stage.service_name
Stage.setup()
Stage.setup_function()
Stage.source_code_hash
Stage.stage_name
Stage.validate_params()
- pisa.core.translation module
- Module contents
- pisa.scripts package
- Submodules
- pisa.scripts.add_flux_to_events_file module
- pisa.scripts.compare module
- pisa.scripts.convert_config_format module
- pisa.scripts.create_barr_sys_tables_mceq module
- pisa.scripts.fit_hypersurfaces module
- pisa.scripts.make_events_file module
- pisa.scripts.make_nufit_theta23_spline_priors module
- pisa.scripts.test_flux_weights module
- Module contents
- pisa.stages package
- Subpackages
- pisa.stages.absorption package
- pisa.stages.aeff package
- pisa.stages.background package
- pisa.stages.data package
- Submodules
- pisa.stages.data.csv_data_hist module
- pisa.stages.data.csv_icc_hist module
- pisa.stages.data.csv_loader module
- pisa.stages.data.grid module
- pisa.stages.data.licloader_weighter module
- pisa.stages.data.meows_loader module
- pisa.stages.data.simple_data_loader module
- pisa.stages.data.simple_signal module
- pisa.stages.data.sqlite_loader module
- pisa.stages.data.toy_event_generator module
- Module contents
- pisa.stages.discr_sys package
- pisa.stages.flux package
- Submodules
- pisa.stages.flux.airs module
- pisa.stages.flux.astrophysical module
- pisa.stages.flux.barr_simple module
- pisa.stages.flux.daemon_flux module
- pisa.stages.flux.hillasg module
- pisa.stages.flux.honda_ip module
- pisa.stages.flux.mceq_barr module
- pisa.stages.flux.mceq_barr_red module
- Module contents
- pisa.stages.likelihood package
- pisa.stages.osc package
- Subpackages
- Submodules
- pisa.stages.osc.decay_params module
- pisa.stages.osc.decoherence module
- pisa.stages.osc.external module
- pisa.stages.osc.globes module
- pisa.stages.osc.layers module
- pisa.stages.osc.lri_params module
- pisa.stages.osc.nsi_params module
- pisa.stages.osc.nusquids module
- pisa.stages.osc.osc_params module
- pisa.stages.osc.prob3 module
- pisa.stages.osc.scaling_params module
- pisa.stages.osc.two_nu_osc module
- Module contents
- pisa.stages.pid package
- pisa.stages.reco package
- pisa.stages.utils package
- Submodules
- pisa.stages.utils.add_indices module
- pisa.stages.utils.adhoc_sys module
- pisa.stages.utils.bootstrap module
- pisa.stages.utils.fix_error module
- pisa.stages.utils.hist module
- pisa.stages.utils.kde module
- pisa.stages.utils.kfold module
- pisa.stages.utils.resample module
- pisa.stages.utils.set_variance module
- Module contents
- pisa.stages.xsec package
- Module contents
- Subpackages
- pisa.utils package
- Subpackages
- Submodules
- pisa.utils.barlow module
Likelihoods
Likelihoods.bestfit_plots
Likelihoods.current_bin
Likelihoods.data_histogram
Likelihoods.get_llh()
Likelihoods.get_llh_barlow_bin()
Likelihoods.get_llh_poisson()
Likelihoods.get_plot()
Likelihoods.get_single_plots()
Likelihoods.mc_histograms
Likelihoods.reset()
Likelihoods.set_data()
Likelihoods.set_mc()
Likelihoods.set_unweighted()
Likelihoods.shape
Likelihoods.unweighted_histograms
- pisa.utils.barr_parameterization module
- pisa.utils.callable module
- pisa.utils.comparisons module
- pisa.utils.config_parser module
- pisa.utils.cross_sections module
CrossSections
CrossSections.get_version()
CrossSections.get_xs_ratio_integral()
CrossSections.get_xs_ratio_value()
CrossSections.get_xs_value()
CrossSections.load()
CrossSections.load_root_file()
CrossSections.new_from_root()
CrossSections.plot()
CrossSections.save()
CrossSections.set_version()
CrossSections.validate_xsec()
manual_test_CrossSections()
- pisa.utils.data_proc_params module
DataProcParams
DataProcParams.apply_cuts()
DataProcParams.cut_bool_idx()
DataProcParams.get_data()
DataProcParams.interpret_data()
DataProcParams.populate_global_namespace()
DataProcParams.retrieve_expression()
DataProcParams.retrieve_node_data()
DataProcParams.subselect()
DataProcParams.validate_cut_spec()
DataProcParams.validate_pid_spec()
- pisa.utils.fileio module
- pisa.utils.fisher_matrix module
FisherMatrix
FisherMatrix.addPrior()
FisherMatrix.calculateCovariance()
FisherMatrix.checkConsistency()
FisherMatrix.fromFile()
FisherMatrix.fromPaPAFile()
FisherMatrix.getBestFit()
FisherMatrix.getCorrelation()
FisherMatrix.getCovariance()
FisherMatrix.getErrorEllipse()
FisherMatrix.getLabel()
FisherMatrix.getParameterIndex()
FisherMatrix.getPrior()
FisherMatrix.getPriorDict()
FisherMatrix.getSigma()
FisherMatrix.getSigmaNoPriors()
FisherMatrix.getSigmaStatistical()
FisherMatrix.getSigmaSystematic()
FisherMatrix.getVariance()
FisherMatrix.printResults()
FisherMatrix.printResultsSorted()
FisherMatrix.removeAllPriors()
FisherMatrix.removeParameter()
FisherMatrix.renameParameter()
FisherMatrix.saveFile()
FisherMatrix.setLabel()
FisherMatrix.setPrior()
FisherMatrix.sortByParam()
FisherMatrix.translatePrior()
- pisa.utils.flavInt module
BarSep
FlavIntData
FlavIntDataGroup
IntType
NuFlav
NuFlavInt
NuFlavIntGroup
NuFlavIntGroup.FLAVINT_RE
NuFlavIntGroup.FLAV_RE
NuFlavIntGroup.IGNORE
NuFlavIntGroup.IT_RE
NuFlavIntGroup.TOKENS
NuFlavIntGroup.antiparticles
NuFlavIntGroup.cc_flavints
NuFlavIntGroup.cc_flavs
NuFlavIntGroup.file_str()
NuFlavIntGroup.flavints
NuFlavIntGroup.flavs
NuFlavIntGroup.group_flavs_by_int_type()
NuFlavIntGroup.insert()
NuFlavIntGroup.interpret()
NuFlavIntGroup.nc_flavints
NuFlavIntGroup.nc_flavs
NuFlavIntGroup.particles
NuFlavIntGroup.remove()
NuFlavIntGroup.simple_str()
NuFlavIntGroup.simple_tex()
NuFlavIntGroup.tex
NuFlavIntGroup.unique_flavs_tex
flavintGroupsFromString()
get_bar_ssep()
set_bar_ssep()
xlateGroupsStr()
- pisa.utils.flux_weights module
- pisa.utils.format module
BIN_PREFIX_TO_POWER_OF_1024
NUMBER_RE
NUMBER_RESTR
ORDER_OF_MAG_TO_SI_PREFIX
POWER_OF_1024_TO_BIN_PREFIX
SI_PREFIX_TO_ORDER_OF_MAG
arg_str_seq_none()
arg_to_tuple()
default_map_tex()
engfmt()
format_num()
hash2hex()
hr_range_formatter()
hrbool2bool()
hrlist2list()
hrlol2lol()
int2hex()
is_tex()
list2hrlist()
make_valid_python_name()
sep_three_tens()
split()
strip_outer_dollars()
strip_outer_parens()
test_format_num()
test_hr_range_formatter()
test_list2hrlist()
test_timediff()
test_timestamp()
tex_dollars()
tex_join()
text2tex()
timediff()
timestamp()
- pisa.utils.gaussians module
- pisa.utils.hash module
- pisa.utils.hdf module
- pisa.utils.hdfchain module
- pisa.utils.jsons module
- pisa.utils.kde_hist module
- pisa.utils.likelihood_functions module
- pisa.utils.llh_client module
- pisa.utils.llh_server module
- pisa.utils.log module
- pisa.utils.matrix module
- pisa.utils.mcSimRunSettings module
DetMCSimRunsSettings
DetMCSimRunsSettings.barnobarfract()
DetMCSimRunsSettings.consistency_checks()
DetMCSimRunsSettings.get_energy_range()
DetMCSimRunsSettings.get_flavints()
DetMCSimRunsSettings.get_flavs()
DetMCSimRunsSettings.get_num_gen()
DetMCSimRunsSettings.get_spectral_index()
DetMCSimRunsSettings.get_xsec()
DetMCSimRunsSettings.get_xsec_version()
MCSimRunSettings
MCSimRunSettings.barnobarfract()
MCSimRunSettings.consistency_checks()
MCSimRunSettings.get_energy_range()
MCSimRunSettings.get_flavints()
MCSimRunSettings.get_flavs()
MCSimRunSettings.get_num_gen()
MCSimRunSettings.get_spectral_index()
MCSimRunSettings.get_xsec()
MCSimRunSettings.get_xsec_version()
MCSimRunSettings.translate_source_dict()
- pisa.utils.numba_tools module
- pisa.utils.plotter module
Plotter
Plotter.add_leg()
Plotter.add_stamp()
Plotter.dump()
Plotter.init_fig()
Plotter.next_color()
Plotter.plot_1d_all()
Plotter.plot_1d_array()
Plotter.plot_1d_cmp()
Plotter.plot_1d_projection()
Plotter.plot_1d_ratio()
Plotter.plot_1d_single()
Plotter.plot_1d_slices_array()
Plotter.plot_1d_stack()
Plotter.plot_2d_array()
Plotter.plot_2d_map()
Plotter.plot_2d_single()
Plotter.plot_array()
Plotter.plot_xsec()
Plotter.project_1d()
Plotter.reset_colors()
Plotter.slices_array()
- pisa.utils.profiler module
- pisa.utils.pull_method module
- pisa.utils.random_numbers module
- pisa.utils.resources module
- pisa.utils.spline module
CombinedSpline
CombinedSpline.compute_integrated_maps()
CombinedSpline.compute_maps()
CombinedSpline.get_integrated_map()
CombinedSpline.get_map()
CombinedSpline.get_spline()
CombinedSpline.reset()
CombinedSpline.return_mapset()
CombinedSpline.scale_map()
CombinedSpline.scale_maps()
CombinedSpline.validate_spline()
Spline
- pisa.utils.spline_smooth module
- pisa.utils.stats module
- pisa.utils.tests module
- pisa.utils.vbwkde module
- pisa.utils.vectorizer module
- Module contents
Module contents
Define globals available to all modules in PISA
- pisa.CACHE_DIR = '/home/runner/.cache/pisa'
Root directory for storing PISA cache files
- pisa.CTYPE
Global complex-valued floating-point data type. C, CUDA, and Numba datatype definitions are derived from this
- pisa.EPSILON = 1e-12
Best precision considering HASH_SIGFIGS (which is chosen kinda ad-hoc but based on by FTYPE)
- pisa.FTYPE
Global floating-point data type. C, CUDA, and Numba datatype definitions are derived from this
- pisa.HASH_SIGFIGS = 12
Round to this many significant figures for hashing numbers, such that machine precision doesn’t cause effectively equivalent numbers to hash differently.
- pisa.OMP_NUM_THREADS = 1
Number of threads OpenMP is allocated
- class pisa.OrderedDict[source]
Bases:
dict
Dictionary that remembers insertion order
- clear() None. Remove all items from od.
- copy() a shallow copy of od
- fromkeys(value=None)
Create a new ordered dictionary with keys from iterable and values set to value.
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- move_to_end(key, last=True)
Move an existing element to the end (or beginning if last is false).
Raise KeyError if the element does not exist.
- pop(key[, default]) v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem(last=True)
Remove and return a (key, value) pair from the dictionary.
Pairs are returned in LIFO order if last is true or FIFO order if false.
- setdefault(key, default=None)
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update([E, ]**F) None. Update D from dict/iterable E and F.
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values() an object providing a view on D's values
- pisa.PISA_NUM_THREADS = 1
Global limit for number of threads
- pisa.Q_
Shortcut for Quantity that uses central PISA Pint unit regeistry
- pisa.array()
- array(object, dtype=None, *, copy=True, order=’K’, subok=False, ndmin=0,
like=None)
Create an array.
- Parameters:
object (array_like) – An array, any object exposing the array interface, an object whose __array__ method returns an array, or any (nested) sequence. If object is a scalar, a 0-dimensional array containing object is returned.
dtype (data-type, optional) – The desired data-type for the array. If not given, then the type will be determined as the minimum type required to hold the objects in the sequence.
copy (bool, optional) – If true (default), then the object is copied. Otherwise, a copy will only be made if __array__ returns a copy, if obj is a nested sequence, or if a copy is needed to satisfy any of the other requirements (dtype, order, etc.).
order ({'K', 'A', 'C', 'F'}, optional) –
Specify the memory layout of the array. If object is not an array, the newly created array will be in C order (row major) unless ‘F’ is specified, in which case it will be in Fortran order (column major). If object is an array the following holds.
order
no copy
copy=True
’K’
unchanged
F & C order preserved, otherwise most similar order
’A’
unchanged
F order if input is F and not C, otherwise C order
’C’
C order
C order
’F’
F order
F order
When
copy=False
and a copy is made for other reasons, the result is the same as ifcopy=True
, with some exceptions for ‘A’, see the Notes section. The default order is ‘K’.subok (bool, optional) – If True, then sub-classes will be passed-through, otherwise the returned array will be forced to be a base-class array (default).
ndmin (int, optional) – Specifies the minimum number of dimensions that the resulting array should have. Ones will be pre-pended to the shape as needed to meet this requirement.
like (array_like) –
Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as
like
supports the__array_function__
protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.Added in version 1.20.0.
- Returns:
out – An array object satisfying the specified requirements.
- Return type:
ndarray
See also
empty_like
Return an empty array with shape and type of input.
ones_like
Return an array of ones with shape and type of input.
zeros_like
Return an array of zeros with shape and type of input.
full_like
Return a new array with shape of input filled with value.
empty
Return a new uninitialized array.
ones
Return a new array setting values to one.
zeros
Return a new array setting values to zero.
full
Return a new array of given shape filled with value.
Notes
When order is ‘A’ and object is an array in neither ‘C’ nor ‘F’ order, and a copy is forced by a change in dtype, then the order of the result is not necessarily ‘C’ as expected. This is likely a bug.
Examples
>>> np.array([1, 2, 3]) array([1, 2, 3])
Upcasting:
>>> np.array([1, 2, 3.0]) array([ 1., 2., 3.])
More than one dimension:
>>> np.array([[1, 2], [3, 4]]) array([[1, 2], [3, 4]])
Minimum dimensions 2:
>>> np.array([1, 2, 3], ndmin=2) array([[1, 2, 3]])
Type provided:
>>> np.array([1, 2, 3], dtype=complex) array([ 1.+0.j, 2.+0.j, 3.+0.j])
Data-type consisting of more than one element:
>>> x = np.array([(1,2),(3,4)],dtype=[('a','<i4'),('b','<i4')]) >>> x['a'] array([1, 3])
Creating an array from sub-classes:
>>> np.array(np.mat('1 2; 3 4')) array([[1, 2], [3, 4]])
>>> np.array(np.mat('1 2; 3 4'), subok=True) matrix([[1, 2], [3, 4]])
- class pisa.complex128(real=0, imag=0)
Bases:
complexfloating
,complex
Complex number type composed of two double-precision floating-point numbers, compatible with Python complex.
- Character code:
'D'
- Canonical name:
numpy.cdouble
- Alias:
numpy.cfloat
- Alias:
numpy.complex_
- Alias on this platform (Linux x86_64):
numpy.complex128: Complex number type composed of 2 64-bit-precision floating-point numbers.
- class pisa.complex256
Bases:
complexfloating
Complex number type composed of two extended-precision floating-point numbers.
- Character code:
'G'
- Canonical name:
numpy.clongdouble
- Alias:
numpy.clongfloat
- Alias:
numpy.longcomplex
- Alias on this platform (Linux x86_64):
numpy.complex256: Complex number type composed of 2 128-bit extended-precision floating-point numbers.
- class pisa.complex64
Bases:
complexfloating
Complex number type composed of two single-precision floating-point numbers.
- Character code:
'F'
- Canonical name:
numpy.csingle
- Alias:
numpy.singlecomplex
- Alias on this platform (Linux x86_64):
numpy.complex64: Complex number type composed of 2 32-bit-precision floating-point numbers.
- class pisa.float32
Bases:
floating
Single-precision floating-point number type, compatible with C
float
.- Character code:
'f'
- Canonical name:
numpy.single
- Alias on this platform (Linux x86_64):
numpy.float32: 32-bit-precision floating-point number type: sign bit, 8 bits exponent, 23 bits mantissa.
- as_integer_ratio()
Return a pair of integers, whose ratio is exactly equal to the original floating point number, and with a positive denominator. Raise OverflowError on infinities and a ValueError on NaNs.
>>> np.single(10.0).as_integer_ratio() (10, 1) >>> np.single(0.0).as_integer_ratio() (0, 1) >>> np.single(-.25).as_integer_ratio() (-1, 4)
- is_integer() bool
Return
True
if the floating point number is finite with integral value, andFalse
otherwise.Added in version 1.22.
Examples
>>> np.single(-2.0).is_integer() True >>> np.single(3.2).is_integer() False
- class pisa.float64(x=0, /)
Bases:
floating
,float
Double-precision floating-point number type, compatible with Python float and C
double
.- Character code:
'd'
- Canonical name:
numpy.double
- Alias:
numpy.float_
- Alias on this platform (Linux x86_64):
numpy.float64: 64-bit precision floating-point number type: sign bit, 11 bits exponent, 52 bits mantissa.
- as_integer_ratio()
Return a pair of integers, whose ratio is exactly equal to the original floating point number, and with a positive denominator. Raise OverflowError on infinities and a ValueError on NaNs.
>>> np.double(10.0).as_integer_ratio() (10, 1) >>> np.double(0.0).as_integer_ratio() (0, 1) >>> np.double(-.25).as_integer_ratio() (-1, 4)
- is_integer() bool
Return
True
if the floating point number is finite with integral value, andFalse
otherwise.Added in version 1.22.
Examples
>>> np.double(-2.0).is_integer() True >>> np.double(3.2).is_integer() False
- class pisa.int16
Bases:
signedinteger
Signed integer type, compatible with C
short
.- Character code:
'h'
- Canonical name:
numpy.short
- Alias on this platform (Linux x86_64):
numpy.int16: 16-bit signed integer (
-32_768
to32_767
).
- bit_count() int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcount
in C++.Examples
>>> np.int16(127).bit_count() 7 >>> np.int16(-127).bit_count() 7
- class pisa.int32
Bases:
signedinteger
Signed integer type, compatible with C
int
.- Character code:
'i'
- Canonical name:
numpy.intc
- Alias on this platform (Linux x86_64):
numpy.int32: 32-bit signed integer (
-2_147_483_648
to2_147_483_647
).
- bit_count() int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcount
in C++.Examples
>>> np.int32(127).bit_count() 7 >>> np.int32(-127).bit_count() 7
- class pisa.int64
Bases:
signedinteger
Signed integer type, compatible with Python int and C
long
.- Character code:
'l'
- Canonical name:
numpy.int_
- Alias on this platform (Linux x86_64):
numpy.int64: 64-bit signed integer (
-9_223_372_036_854_775_808
to9_223_372_036_854_775_807
).- Alias on this platform (Linux x86_64):
numpy.intp: Signed integer large enough to fit pointer, compatible with C
intptr_t
.
- bit_count() int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcount
in C++.Examples
>>> np.int64(127).bit_count() 7 >>> np.int64(-127).bit_count() 7
- class pisa.int8
Bases:
signedinteger
Signed integer type, compatible with C
char
.- Character code:
'b'
- Canonical name:
numpy.byte
- Alias on this platform (Linux x86_64):
numpy.int8: 8-bit signed integer (
-128
to127
).
- bit_count() int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcount
in C++.Examples
>>> np.int8(127).bit_count() 7 >>> np.int8(-127).bit_count() 7
- pisa.namedtuple(typename, field_names, *, rename=False, defaults=None, module=None)[source]
Returns a new subclass of tuple with named fields.
>>> Point = namedtuple('Point', ['x', 'y']) >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) # instantiate with positional args or keywords >>> p[0] + p[1] # indexable like a plain tuple 33 >>> x, y = p # unpack like a regular tuple >>> x, y (11, 22) >>> p.x + p.y # fields also accessible by name 33 >>> d = p._asdict() # convert to a dictionary >>> d['x'] 11 >>> Point(**d) # convert from a dictionary Point(x=11, y=22) >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields Point(x=100, y=22)
- pisa.numba_jit(signature_or_function=None, locals={}, cache=False, pipeline_class=None, boundscheck=None, **options)
This decorator is used to compile a Python function into native code.
- Parameters:
signature_or_function – The (optional) signature or list of signatures to be compiled. If not passed, required signatures will be compiled when the decorated function is called, depending on the argument values. As a convenience, you can directly pass the function to be compiled instead.
locals (dict) – Mapping of local variable names to Numba types. Used to override the types deduced by Numba’s type inference engine.
pipeline_class (type numba.compiler.CompilerBase) – The compiler pipeline type for customizing the compilation stages.
options –
- For a cpu target, valid options are:
- nopython: bool
Set to True to disable the use of PyObjects and Python API calls. The default behavior is to allow the use of PyObjects and Python API. Default value is True.
- forceobj: bool
Set to True to force the use of PyObjects for every value. Default value is False.
- looplift: bool
Set to True to enable jitting loops in nopython mode while leaving surrounding code in object mode. This allows functions to allocate NumPy arrays and use Python objects, while the tight loops in the function can still be compiled in nopython mode. Any arrays that the tight loop uses should be created before the loop is entered. Default value is True.
- error_model: str
The error-model affects divide-by-zero behavior. Valid values are ‘python’ and ‘numpy’. The ‘python’ model raises exception. The ‘numpy’ model sets the result to +/-inf or nan. Default value is ‘python’.
- inline: str or callable
The inline option will determine whether a function is inlined at into its caller if called. String options are ‘never’ (default) which will never inline, and ‘always’, which will always inline. If a callable is provided it will be called with the call expression node that is requesting inlining, the caller’s IR and callee’s IR as arguments, it is expected to return Truthy as to whether to inline. NOTE: This inlining is performed at the Numba IR level and is in no way related to LLVM inlining.
- boundscheck: bool or None
Set to True to enable bounds checking for array indices. Out of bounds accesses will raise IndexError. The default is to not do bounds checking. If False, bounds checking is disabled, out of bounds accesses can produce garbage results or segfaults. However, enabling bounds checking will slow down typical functions, so it is recommended to only use this flag for debugging. You can also set the NUMBA_BOUNDSCHECK environment variable to 0 or 1 to globally override this flag. The default value is None, which under normal execution equates to False, but if debug is set to True then bounds checking will be enabled.
- Returns:
A callable usable as a compiled function. Actual compiling will be
done lazily if no explicit signatures are passed.
Examples
The function can be used in the following ways:
jit(signatures, **targetoptions) -> jit(function)
Equivalent to:
d = dispatcher(function, targetoptions) for signature in signatures:
d.compile(signature)
Create a dispatcher object for a python function. Then, compile the function with the given signature(s).
Example:
@jit(“int32(int32, int32)”) def foo(x, y):
return x + y
@jit([“int32(int32, int32)”, “float32(float32, float32)”]) def bar(x, y):
return x + y
jit(function, **targetoptions) -> dispatcher
Create a dispatcher function object that specializes at call site.
Examples:
@jit def foo(x, y):
return x + y
@jit(nopython=True) def bar(x, y):
return x + y
- class pisa.uint16
Bases:
unsignedinteger
Unsigned integer type, compatible with C
unsigned short
.- Character code:
'H'
- Canonical name:
numpy.ushort
- Alias on this platform (Linux x86_64):
numpy.uint16: 16-bit unsigned integer (
0
to65_535
).
- bit_count() int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcount
in C++.Examples
>>> np.uint16(127).bit_count() 7
- class pisa.uint32
Bases:
unsignedinteger
Unsigned integer type, compatible with C
unsigned int
.- Character code:
'I'
- Canonical name:
numpy.uintc
- Alias on this platform (Linux x86_64):
numpy.uint32: 32-bit unsigned integer (
0
to4_294_967_295
).
- bit_count() int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcount
in C++.Examples
>>> np.uint32(127).bit_count() 7
- class pisa.uint64
Bases:
unsignedinteger
Unsigned integer type, compatible with C
unsigned long
.- Character code:
'L'
- Canonical name:
numpy.uint
- Alias on this platform (Linux x86_64):
numpy.uint64: 64-bit unsigned integer (
0
to18_446_744_073_709_551_615
).- Alias on this platform (Linux x86_64):
numpy.uintp: Unsigned integer large enough to fit pointer, compatible with C
uintptr_t
.
- bit_count() int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcount
in C++.Examples
>>> np.uint64(127).bit_count() 7
- class pisa.uint8
Bases:
unsignedinteger
Unsigned integer type, compatible with C
unsigned char
.- Character code:
'B'
- Canonical name:
numpy.ubyte
- Alias on this platform (Linux x86_64):
numpy.uint8: 8-bit unsigned integer (
0
to255
).
- bit_count() int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcount
in C++.Examples
>>> np.uint8(127).bit_count() 7
- pisa.ureg = <pint.registry.UnitRegistry object>
Single Pint unit registry that should be used by all PISA code