Data Classes
The Base classes defined for Profile, and so on.
Profile class
The Class of Profile
- class tatpulsar.data.profile.Profile(counts, cycles=1, error=None)[source]
Profile class
- Parameters
counts : array-like
the counts in each phase bin of Profile
cycles : int
the period cycles of input Profile (default is 1). If cycles=2, the phase of profile would be
np.linspace(0, 2, size_of_Profile+1)[:-1]
error : array-like
the error of each phase bin, if not given the error will be the poisson error of counts (sqruare root of counts)
- Attributes
counts : array-like
The counts in each phase bin of Profile
phase : array-like
The midpoints of phase bins
phase_off : list
The list of phase off interval, the two value are the left and right phase bin of off pulse phases. left_edge = phase_off[0] right_edge = phase_ff[1]
- norm(method=0, bkg_range=None)[source]
normalize the profile, and return a normalized Profile object
bkg_range is the background phase range selected to calculated the mean level of background, used in method=0.
- Parameters
method: int, optional
The normalization method utilized, optional methods are {0, 1} method = 0 : \(N = (P - P_{min})/(P_{max} - P_{min})\) if background range are selected (bkg_range is not None) \(N = (P - \bar{B})/(P_{max} - \bar{B})\) where \(\bar{B}\) is the mean level in bkg_range method = 1 : \(N = (P-P_{min})/\bar{P}\)
bkg_range: list, optional
The background phase range for background estimation
- resample(sample_num=1, kind='poisson')[source]
resampling the profile
- Parameters
sample_num : int, optional
number of the resamplings for the profile, the default number is 1
kind : str, optional
The distribution of the profile, default is poisson. (‘poisson’, ‘gaussian’) are refering to the poisson and gauss distribution
- Returns
resampled_profile : array or ndarray
if sample_num == 1, return a one dimensional array if sample_num >1 , return a multi-dimensional array
- tatpulsar.data.profile.phihist(phi, nbins, **kwargs)[source]
Ensure that the input and output of the histogram are appropriate. The input variables are the pulse phi of events, and the nbins. The counts of each bin are calculated by dividing [0, 1] into number of nbins.
- Parameters
phi : array
a set of phase value of events.
nbins : int
the number of bins of profile
- Returns
Profile : object
return the object of Profile