pisa package
Subpackages
- pisa.analysis package
- pisa.core package
- Submodules
- pisa.core.bin_indexing module
- pisa.core.binning module
MultiDimBinningMultiDimBinning.assert_array_fits()MultiDimBinning.assert_compat()MultiDimBinning.basename_binningMultiDimBinning.basenamesMultiDimBinning.bin_edgesMultiDimBinning.bin_volumes()MultiDimBinning.broadcast()MultiDimBinning.broadcaster()MultiDimBinning.coordMultiDimBinning.dimensionsMultiDimBinning.dimsMultiDimBinning.domainsMultiDimBinning.downsample()MultiDimBinning.edges_hashMultiDimBinning.empty()MultiDimBinning.finite_binningMultiDimBinning.from_json()MultiDimBinning.full()MultiDimBinning.hashMultiDimBinning.hashable_stateMultiDimBinning.inbounds_criteriaMultiDimBinning.index()MultiDimBinning.index2coord()MultiDimBinning.indexer()MultiDimBinning.is_compat()MultiDimBinning.is_irregularMultiDimBinning.is_linMultiDimBinning.is_logMultiDimBinning.iterbins()MultiDimBinning.itercoords()MultiDimBinning.iterdims()MultiDimBinning.iteredgetuples()MultiDimBinning.ito()MultiDimBinning.maskMultiDimBinning.mask_hashMultiDimBinning.meshgrid()MultiDimBinning.midpointsMultiDimBinning.nameMultiDimBinning.namesMultiDimBinning.normalize_valuesMultiDimBinning.normalized_stateMultiDimBinning.num_binsMultiDimBinning.num_dimsMultiDimBinning.ones()MultiDimBinning.oversample()MultiDimBinning.remove()MultiDimBinning.reorder_dimensions()MultiDimBinning.serializable_stateMultiDimBinning.shapeMultiDimBinning.sizeMultiDimBinning.slice()MultiDimBinning.squeeze()MultiDimBinning.to()MultiDimBinning.to_json()MultiDimBinning.tot_num_binsMultiDimBinning.unitsMultiDimBinning.weighted_bin_volumes()MultiDimBinning.weighted_centersMultiDimBinning.zeros()
OneDimBinningOneDimBinning.assert_compat()OneDimBinning.basenameOneDimBinning.basename_binningOneDimBinning.bin_edgesOneDimBinning.bin_namesOneDimBinning.bin_widthsOneDimBinning.domainOneDimBinning.downsample()OneDimBinning.edge_magnitudesOneDimBinning.edges_hashOneDimBinning.finite_binningOneDimBinning.from_json()OneDimBinning.hashOneDimBinning.hashable_stateOneDimBinning.inbounds_criteriaOneDimBinning.index()OneDimBinning.is_bin_spacing_lin_uniform()OneDimBinning.is_bin_spacing_log_uniform()OneDimBinning.is_binning_ok()OneDimBinning.is_compat()OneDimBinning.is_irregularOneDimBinning.is_linOneDimBinning.is_logOneDimBinning.iterbins()OneDimBinning.iteredgetuples()OneDimBinning.ito()OneDimBinning.labelOneDimBinning.midpointsOneDimBinning.nameOneDimBinning.normalize_valuesOneDimBinning.normalized_stateOneDimBinning.num_binsOneDimBinning.oversample()OneDimBinning.rangeOneDimBinning.rehash()OneDimBinning.serializable_stateOneDimBinning.shapeOneDimBinning.sizeOneDimBinning.texOneDimBinning.to()OneDimBinning.to_json()OneDimBinning.unitsOneDimBinning.weighted_bin_widthsOneDimBinning.weighted_centers
VarBinningbasename()is_binning()test_MultiDimBinning()test_OneDimBinning()test_VarBinning()
- pisa.core.container module
ContainerContainer.all_keysContainer.all_keys_incl_aux_dataContainer.array_representationsContainer.array_to_binned()Container.auto_translate()Container.binned_to_array()Container.default_translation_modeContainer.find_valid_representation()Container.get_hist()Container.get_keep_mask()Container.get_map()Container.is_mapContainer.keysContainer.keys_incl_aux_dataContainer.mark_changed()Container.mark_valid()Container.num_dimsContainer.representationContainer.representation_keysContainer.representationsContainer.resample()Container.set_aux_data()Container.shapeContainer.sizeContainer.translate()Container.translation_modesContainer.unroll_binning()
ContainerSetVirtualContainertest_container()test_container_set()
- pisa.core.detectors module
DetectorsDetectors.distribution_makersDetectors.empty_bin_indicesDetectors.get_outputs()Detectors.hashDetectors.init_params()Detectors.num_events_per_binDetectors.param_selectionsDetectors.paramsDetectors.profileDetectors.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_listDetectors.source_code_hashDetectors.tabulate()Detectors.update_params()
main()parse_args()test_Detectors()
- pisa.core.distribution_maker module
DistributionMakerDistributionMaker.add_covariance()DistributionMaker.empty_bin_indicesDistributionMaker.get_outputs()DistributionMaker.hashDistributionMaker.num_events_per_binDistributionMaker.param_selectionsDistributionMaker.paramsDistributionMaker.pipelinesDistributionMaker.profileDistributionMaker.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_hashDistributionMaker.tabulate()DistributionMaker.update_params()
main()parse_args()test_DistributionMaker()
- pisa.core.events module
- pisa.core.events_pi module
- pisa.core.map module
MapMap.allclose()Map.assert_compat()Map.barlow_llh()Map.binningMap.chi2()Map.compare()Map.conv_llh()Map.correct_chi2()Map.downsample()Map.fluctuate()Map.from_json()Map.full_comparisonMap.generalized_poisson_llh()Map.hashMap.hashable_stateMap.histMap.item()Map.iterbins()Map.itercoords()Map.llh()Map.log()Map.log10()Map.mcllh_eff()Map.mcllh_mean()Map.metric_total()Map.mod_chi2()Map.nameMap.nominal_valuesMap.normalize_valuesMap.num_entriesMap.plot()Map.project()Map.rebin()Map.reorder_dimensions()Map.round2int()Map.serializable_stateMap.set_errors()Map.set_poisson_errors()Map.shapeMap.signed_sqrt_mod_chi2()Map.sizeMap.slice()Map.split()Map.sqrt()Map.squeeze()Map.std_devsMap.sum()Map.texMap.to_json()
MapSetMapSet.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.hashMapSet.hash_maps()MapSet.hashesMapSet.index()MapSet.llh_per_map()MapSet.llh_total()MapSet.log()MapSet.log10()MapSet.metric_per_map()MapSet.metric_total()MapSet.nameMapSet.namesMapSet.plot()MapSet.pop()MapSet.project()MapSet.rebin()MapSet.reorder_dimensions()MapSet.serializable_stateMapSet.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
DerivedParamParamParam.dimensionalityParam.from_json()Param.hashParam.ito()Param.mParam.m_as()Param.magnitudeParam.nominal_valueParam.priorParam.prior_chi2Param.prior_llhParam.prior_penalty()Param.randomize()Param.rangeParam.reset()Param.serializable_stateParam.set_nominal_to_current_value()Param.stateParam.texParam.to()Param.to_json()Param.uParam.unitsParam.validate_value()Param.value
ParamSelectorParamSetParamSet.add_covariance()ParamSet.are_discreteParamSet.are_fixedParamSet.continuousParamSet.discreteParamSet.extend()ParamSet.fix()ParamSet.fixedParamSet.freeParamSet.from_json()ParamSet.has_derivedParamSet.hashParamSet.index()ParamSet.insert()ParamSet.is_nominalParamSet.issubset()ParamSet.issuperset()ParamSet.name_val_dictParamSet.namesParamSet.nominal_valuesParamSet.nominal_values_hashParamSet.priorsParamSet.priors_chi2ParamSet.priors_llhParamSet.priors_penalties()ParamSet.priors_penalty()ParamSet.randomize_free()ParamSet.rangesParamSet.replace()ParamSet.reset_all()ParamSet.reset_free()ParamSet.serializable_stateParamSet.set_nominal_by_current_values()ParamSet.set_values()ParamSet.stateParamSet.tabulate()ParamSet.texParamSet.to_json()ParamSet.unfix()ParamSet.update()ParamSet.update_existing()ParamSet.valuesParamSet.values_hash
test_Param()test_ParamSelector()test_ParamSet()
- pisa.core.pipeline module
PipelinePipeline.add_covariance()Pipeline.assert_apply_modes_consistency()Pipeline.assert_exclusive_varbinning()Pipeline.assert_varbinning_compat()Pipeline.configPipeline.get_outputs()Pipeline.hashPipeline.index()Pipeline.output_binningPipeline.param_selectionsPipeline.paramsPipeline.profilePipeline.report_profile()Pipeline.run()Pipeline.select_params()Pipeline.service_namesPipeline.setup()Pipeline.source_code_hashPipeline.stage_namesPipeline.stagesPipeline.tabulate()Pipeline.update_params()
main()parse_args()test_Pipeline()
- pisa.core.prior module
- pisa.core.stage module
StageStage.apply()Stage.apply_function()Stage.apply_modeStage.calc_modeStage.compute()Stage.compute_function()Stage.dataStage.debug_modeStage.error_methodStage.expected_container_keysStage.expected_paramsStage.full_hashStage.hashStage.in_standalone_modeStage.include_attrs_for_hashes()Stage.is_mapStage.param_hashStage.param_selectionsStage.paramsStage.profileStage.report_profile()Stage.run()Stage.select_params()Stage.service_nameStage.setup()Stage.setup_function()Stage.source_code_hashStage.stage_nameStage.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
- pisa.stages.xsec package
- Module contents
- Subpackages
- pisa.utils package
- Subpackages
- Submodules
- pisa.utils.barlow module
LikelihoodsLikelihoods.bestfit_plotsLikelihoods.current_binLikelihoods.data_histogramLikelihoods.get_llh()Likelihoods.get_llh_barlow_bin()Likelihoods.get_llh_poisson()Likelihoods.get_plot()Likelihoods.get_single_plots()Likelihoods.mc_histogramsLikelihoods.reset()Likelihoods.set_data()Likelihoods.set_mc()Likelihoods.set_unweighted()Likelihoods.shapeLikelihoods.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
CrossSectionsCrossSections.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
DataProcParamsDataProcParams.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
FisherMatrixFisherMatrix.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
BarSepFlavIntDataFlavIntDataGroupIntTypeNuFlavNuFlavIntNuFlavIntGroupNuFlavIntGroup.FLAVINT_RENuFlavIntGroup.FLAV_RENuFlavIntGroup.IGNORENuFlavIntGroup.IT_RENuFlavIntGroup.TOKENSNuFlavIntGroup.antiparticlesNuFlavIntGroup.cc_flavintsNuFlavIntGroup.cc_flavsNuFlavIntGroup.file_str()NuFlavIntGroup.flavintsNuFlavIntGroup.flavsNuFlavIntGroup.group_flavs_by_int_type()NuFlavIntGroup.insert()NuFlavIntGroup.interpret()NuFlavIntGroup.nc_flavintsNuFlavIntGroup.nc_flavsNuFlavIntGroup.particlesNuFlavIntGroup.remove()NuFlavIntGroup.simple_str()NuFlavIntGroup.simple_tex()NuFlavIntGroup.texNuFlavIntGroup.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_1024NUMBER_RENUMBER_RESTRORDER_OF_MAG_TO_SI_PREFIXPOWER_OF_1024_TO_BIN_PREFIXSI_PREFIX_TO_ORDER_OF_MAGarg_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
DetMCSimRunsSettingsDetMCSimRunsSettings.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()
MCSimRunSettingsMCSimRunSettings.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
PlotterPlotter.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
CombinedSplineCombinedSpline.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:
dictDictionary 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=Falseand 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
likesupports 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_likeReturn an empty array with shape and type of input.
ones_likeReturn an array of ones with shape and type of input.
zeros_likeReturn an array of zeros with shape and type of input.
full_likeReturn a new array with shape of input filled with value.
emptyReturn a new uninitialized array.
onesReturn a new array setting values to one.
zerosReturn a new array setting values to zero.
fullReturn 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,complexComplex 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:
complexfloatingComplex 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:
complexfloatingComplex 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:
floatingSingle-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
Trueif the floating point number is finite with integral value, andFalseotherwise.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,floatDouble-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
Trueif the floating point number is finite with integral value, andFalseotherwise.Added in version 1.22.
Examples
>>> np.double(-2.0).is_integer() True >>> np.double(3.2).is_integer() False
- class pisa.int16
Bases:
signedintegerSigned 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_768to32_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
popcountin C++.Examples
>>> np.int16(127).bit_count() 7 >>> np.int16(-127).bit_count() 7
- class pisa.int32
Bases:
signedintegerSigned 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_648to2_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
popcountin C++.Examples
>>> np.int32(127).bit_count() 7 >>> np.int32(-127).bit_count() 7
- class pisa.int64
Bases:
signedintegerSigned 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_808to9_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
popcountin C++.Examples
>>> np.int64(127).bit_count() 7 >>> np.int64(-127).bit_count() 7
- class pisa.int8
Bases:
signedintegerSigned 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 (
-128to127).
- bit_count() int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcountin 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=mappingproxy({}), 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:
unsignedintegerUnsigned 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 (
0to65_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
popcountin C++.Examples
>>> np.uint16(127).bit_count() 7
- class pisa.uint32
Bases:
unsignedintegerUnsigned 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 (
0to4_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
popcountin C++.Examples
>>> np.uint32(127).bit_count() 7
- class pisa.uint64
Bases:
unsignedintegerUnsigned 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 (
0to18_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
popcountin C++.Examples
>>> np.uint64(127).bit_count() 7
- class pisa.uint8
Bases:
unsignedintegerUnsigned 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 (
0to255).
- bit_count() int
Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or
popcountin 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