Skip to content

Commit

Permalink
Fixed documentation issues
Browse files Browse the repository at this point in the history
Signed-off-by: Devansh Agarwal <[email protected]>
  • Loading branch information
devanshkv committed Jan 20, 2021
1 parent ccfd38f commit 726c3b9
Show file tree
Hide file tree
Showing 16 changed files with 111 additions and 112 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Here are some [tutorial notebooks](https://github.com/devanshkv/your/tree/master
We welcome all types of code contribution. Please have a look at our [guideline](CONTRIBUTING.md) and [code of conduct](CODE_OF_CONDUCT.md).

# Citation
If you use `Your`, please cite our [JOSS Paper](https://joss.theoj.org/papers/10.21105/joss.02750): [![status](https://joss.theoj.org/papers/798844ebd352f563de28bb75515da674/status.svg?style=flat-square)](https://joss.theoj.org/papers/798844ebd352f563de28bb75515da674)
If you use `Your`, please cite our [JOSS Paper](https://joss.theoj.org/papers/10.21105/joss.02750):

```bash
@article{Aggarwal2020,
Expand Down
2 changes: 1 addition & 1 deletion docs/autogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
mdFile.create_md_file()

# Convert all note tabs so that it looks cooler with the material theme
linebreaker_list = ["Args:", "Examples:", "Returns:", "Attributes:"]
linebreaker_list = ["Args:", "Examples:", "Returns:", "Attributes:", "Raises:"]

for dname, dirs, files in os.walk("sources"):
for fname in files:
Expand Down
2 changes: 1 addition & 1 deletion docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ nav:
- Reference API:
- Core:
- Your: your.md
- Candiate: candidate.md
- Candidate: candidate.md
- Writer: writer.md
- Formats:
- Psrdada: formats/psrdada.md
Expand Down
6 changes: 3 additions & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
keras-autodoc>=0.6.0
keras-autodoc>=0.7.0
mkdocs>=1.1.2
mkdocs-material>=6.0
mkdocs-material>=6.2.5
argmark>=0.1
mkdocs-jupyter>=0.13.0
mkdocs-jupyter>=0.15.1
2 changes: 1 addition & 1 deletion your/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from your.writer import *
from your.your import *

__version__ = "0.6.0"
__version__ = "0.6.1"
12 changes: 6 additions & 6 deletions your/candidate.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Candidate(Your):
Candidate Class
Args:
fp Union[str, List]: String or a list of files. It can either filterbank or psrfits files.
fp Union[str, list]: String or a list of files. It can either filterbank or psrfits files.
dm (float): Dispersion Measure of the candidate
tcand (float): start time of the candidate in seconds at the highest frequency channel
width (int): pulse width of the candidate in samples
Expand Down Expand Up @@ -134,7 +134,7 @@ def dispersion_delay(self, dms=None):
Calculate the dispersion delay for the candidate DM or at given dispersion DM
Args:
dms (Union[float,np.ndarray]) : DM or a list of DMs
dms (Union[float,np.ndarray]): DM or a list of DMs
Returns:
Union[float, np.ndarray]: dispersion delay in seconds
Expand Down Expand Up @@ -342,7 +342,7 @@ def dmtime(self, dmsteps=256, target="CPU"):
Our method rolls the data around while dedispersing it.
Args:
dmsteps (int) : Number of DMs to dedisperse at.
dmsteps (int): Number of DMs to dedisperse at.
target (str): 'CPU' to run the code on the CPU or 'GPU' to run it on a GPU.
"""
Expand All @@ -361,7 +361,7 @@ def get_snr(self, time_series=None):
Calculates the SNR of the candidate
Args:
time_series (np.ndarray) : time series array to calculate the SNR of
time_series (np.ndarray): time series array to calculate the SNR of
Returns:
float: SNR
Expand All @@ -387,7 +387,7 @@ def optimize_dm(self):
This function has not been fully tested.
Returns:
optimnised DM, optimised SNR
Optimized DM, optimised SNR
"""
if self.data is None:
return None
Expand Down Expand Up @@ -457,7 +457,7 @@ def resize(self, key, size, axis, **kwargs):
Args:
key (str): Keywords to chose which data to resize ('dmt' or 'ft')
size: Final size of the data array required
axis (int) : Axis to resize alone
axis (int): Axis to resize alone
**kwargs: Arguments for skimage.transform resize function
"""
Expand Down
3 changes: 0 additions & 3 deletions your/formats/dada.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ class DadaManager:
Args:
size (int): size of each buffer (in bytes)
key (hex): hexadecimal dada key
n_readers (int): Number of dada readers.
"""

Expand Down Expand Up @@ -58,7 +56,6 @@ def dump_data(self, data_input):
Dump the data to the buffer
Args:
data_input (numpy.ndarray): Numpy array of the data.
"""
Expand Down
38 changes: 19 additions & 19 deletions your/formats/filwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,25 @@ def make_sigproc_object(
Create a Sigprocfile from scratch.
Args:
rawdatafile (str) : Raw file name
source_name (str) : Source Name
nchans (int) : Number of channels
foff (float) : Channel Bandwidth (MHz)
fch1 (float) : Frequncy of first channel (MHz)
tsamp (float) : Sampling interval (seconds)
tstart (float) : MJD of the start sample
src_raj (float) : RA of the source in format HHMMSS.SS
src_dej (float) : Dec of source in format DDMMSS.SS
machine_id (int) : Machine ID
nbeams (int) : Number of beams in the rcvr
ibeam (int) : Beam number
nbits (int) : Number of bits
nifs (int) : Number of IFs
barycentric (int) : 0 for not barycentered data, 1 otherwise.
pulsarcentric (int) : 0 for not pulsarcentered data, 1 otherwise.
telescope_id (int) : Telescope ID
data_type (int) : Data Type
az_start (float) : Azimuth Angle start
rawdatafile (str): Raw file name
source_name (str): Source Name
nchans (int): Number of channels
foff (float): Channel Bandwidth (MHz)
fch1 (float): Frequncy of first channel (MHz)
tsamp (float): Sampling interval (seconds)
tstart (float): MJD of the start sample
src_raj (float): RA of the source in format HHMMSS.SS
src_dej (float): Dec of source in format DDMMSS.SS
machine_id (int): Machine ID
nbeams (int): Number of beams in the rcvr
ibeam (int): Beam number
nbits (int): Number of bits
nifs (int): Number of IFs
barycentric (int): 0 for not barycentered data, 1 otherwise.
pulsarcentric (int): 0 for not pulsarcentered data, 1 otherwise.
telescope_id (int): Telescope ID
data_type (int): Data Type
az_start (float): Azimuth Angle start
za_start (float): Zenith Angle start
Returns:
Expand Down
46 changes: 23 additions & 23 deletions your/formats/psrfits.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def unpack_2bit(data):
Unpack 2-bit data that has been read in as bytes.
Args:
data (np.ndarray) : array of unsigned 2-bit ints packed into an array of bytes.
data (np.ndarray): array of unsigned 2-bit ints packed into an array of bytes.
Returns:
np.ndarray: unpacked array. The size of this array will be four times the size of the input data.
Expand All @@ -52,7 +52,7 @@ def unpack_4bit(data):
Unpack 4-bit data that has been read in as bytes.
Args:
data (np.ndarray) : array of unsigned 4-bit ints packed into an array of bytes.
data (np.ndarray): array of unsigned 4-bit ints packed into an array of bytes.
Returns:
np.ndarray: unpacked array. The size of this array will be twice the size of the input data.
Expand Down Expand Up @@ -81,7 +81,7 @@ class PsrfitsFile(object):
specinfo (obj): Object of class SpectraInfo for the given file list
header (list): Header of the fits file
source_name (str): Source Name
machine_id (int) : Machine ID
machine_id (int): Machine ID
barycentric (int): If 1 the data is barycentered
pulsarcentric (int): Is the data in pulsar's frame of reference?
src_raj (float): RA of the source (HHMMSS.SS)
Expand Down Expand Up @@ -143,7 +143,7 @@ def nspectra(self):
"""
Returns:
int : Total number of spectra in all files in filelist
int: Total number of spectra in all files in filelist
"""
return int(self.specinfo.spectra_per_subint * np.sum(self.specinfo.num_subint))
Expand All @@ -153,7 +153,7 @@ def native_nspectra(self):
Native number of total spectra in all the files. This will be made a property so that it can't be overwritten
Returns:
int : Total number of spectra in all files in filelist
int: Total number of spectra in all files in filelist
"""
return int(self.specinfo.spectra_per_subint * np.sum(self.specinfo.num_subint))
Expand All @@ -163,7 +163,7 @@ def native_tsamp(self):
This will be made a property so that it can't be overwritten.
Returns:
float : Native sampling time of the file.
float: Native sampling time of the file.
"""
return self.specinfo.dt
Expand All @@ -173,7 +173,7 @@ def native_foff(self):
This will be made a property so that it can't be overwritten.
Returns:
float : Native channel bandwidth
float: Native channel bandwidth
"""
return self.bw / self.nchan
Expand All @@ -196,13 +196,13 @@ def read_subint(
Applys scales, weights, and offsets to the data.
Args:
isub (int) : index of subint (first subint is 0)
apply_weights (bool) : If True, apply weights. (Default: apply weights)
apply_scales (bool) : If True, apply scales. (Default: apply scales)
apply_offsets (bool) : If True, apply offsets. (Default: apply offsets)
isub (int): index of subint (first subint is 0)
apply_weights (bool): If True, apply weights. (Default: apply weights)
apply_scales (bool): If True, apply scales. (Default: apply scales)
apply_offsets (bool): If True, apply offsets. (Default: apply offsets)
Returns:
np.ndarray : Subint data with scales, weights, and offsets applied in float32 dtype with shape (nsamps,nchan).
np.ndarray: Subint data with scales, weights, and offsets applied in float32 dtype with shape (nsamps,nchan).
"""
sdata = self.fits["SUBINT"].data[isub]["DATA"]
Expand Down Expand Up @@ -278,10 +278,10 @@ def get_weights(self, isub):
Return weights for a particular subint.
Args:
isub (int) : index of subint (first subint is 0)
isub (int): index of subint (first subint is 0)
Returns:
np.ndarray : Subint weights. (There is one value for each channel)
np.ndarray: Subint weights. (There is one value for each channel)
"""
return self.fits["SUBINT"].data[isub]["DAT_WTS"]
Expand All @@ -291,10 +291,10 @@ def get_scales(self, isub):
Return scales for a particular subint.
Args:
isub (int) : index of subint (first subint is 0)
isub (int): index of subint (first subint is 0)
Returns:
np.ndarray : Subint scales. (There is one value for each channel)
np.ndarray: Subint scales. (There is one value for each channel)
"""
return self.fits["SUBINT"].data[isub]["DAT_SCL"]
Expand All @@ -304,10 +304,10 @@ def get_offsets(self, isub):
Return offsets for a particular subint.
Args:
isub (int) : index of subint (first subint is 0)
isub (int): index of subint (first subint is 0)
Returns:
np.ndarray : Subint offsets. (There is one value for each channel)
np.ndarray: Subint offsets. (There is one value for each channel)
"""
return self.fits["SUBINT"].data[isub]["DAT_OFFS"]
Expand All @@ -317,12 +317,12 @@ def get_data(self, nstart, nsamp, pol=0):
Return 2D array of data from PSRFITS files.
Args:
nstart (int) : Starting sample
nsamp (int) : number of samples to read
pol (int) : which polarization to return
nstart (int): Starting sample
nsamp (int): number of samples to read
pol (int): which polarization to return
Returns:
np.ndarray : Time-Frequency numpy array
np.ndarray: Time-Frequency numpy array
"""
# Calculate starting subint and ending subint
Expand Down Expand Up @@ -427,7 +427,7 @@ class SpectraInfo:
Class to read the header of fits files
Args:
filenames (list) : list of fits files
filenames (list): list of fits files
"""

def __init__(self, filenames):
Expand Down
16 changes: 10 additions & 6 deletions your/formats/pysigproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SigprocFile(object):
rawdatafile (str): Raw data file
source_name (str): Source Name
machine_id (int) : Machine ID
machine_id (int): Machine ID
barycentric (int): If 1 the data is barycentered
pulsarcentric (int): Is the data in pulsar's frame of reference?
src_raj (float): RA of the source (HHMMSS.SS)
Expand Down Expand Up @@ -230,7 +230,8 @@ def read_header(self, fp=None):
def dtype(self):
"""
Returns: dtype of the data
Returns:
dtype of the data
"""
if self.nbits == 8:
Expand All @@ -246,15 +247,17 @@ def dtype(self):
def bytes_per_spectrum(self):
"""
Returns: bytes per spectrum
Returns:
bytes per spectrum
"""
return self.nbits * self.nchans * self.nifs / 8

def nspectra(self):
"""
Returns: Number of specrta in the file
Returns:
Number of specrta in the file
"""
return (self._mmdata.size() - self.hdrbytes) / self.bytes_per_spectrum
Expand All @@ -264,7 +267,8 @@ def native_nspectra(self):
Native number of spectra in the file. This will be made a property so that it can't be overwritten
Returns:Number of specrta in the file
Returns:
Number of specrta in the file
"""

Expand Down Expand Up @@ -378,7 +382,7 @@ def append_spectra(spectra, filename):
Append spectra to the end of the file
Args:
spectra (numpy.ndarray) : numpy array of the data to be dumped into the filterbank file
spectra (numpy.ndarray): numpy array of the data to be dumped into the filterbank file
filename (str): name of the filterbank file
"""
with open(filename, "ab") as f:
Expand Down
4 changes: 2 additions & 2 deletions your/utils/heimdall.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ class HeimdallManager:
filename (str): process specified SIGPROC filterbank file
verbosity (str): v, V, g, G increase verbosity level
nsamps_gulp (int): number of samples to be read at a time
beam (int) : over-ride beam number
beam (int): over-ride beam number
baseline_length (float): number of seconds over which to smooth the baseline
output_dir (str) : create all output files in specified path
output_dir (str): create all output files in specified path
dm (list): min and max DM
dm_tol (float): SNR loss tolerance between each DM trial
zap_chans (int): zap all channels between start and end channels inclusive
Expand Down
Loading

0 comments on commit 726c3b9

Please sign in to comment.