Skip to content

Commit

Permalink
Merge pull request #27 from radionets-project/cleanup_docu
Browse files Browse the repository at this point in the history
Cleanup docu
  • Loading branch information
Kevin2 authored Nov 9, 2023
2 parents 7265b3f + 7e2e03a commit 5ae0bbc
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 209 deletions.
2 changes: 2 additions & 0 deletions docs/changes/27.maintenance.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- add docstrings
- delete unused files
56 changes: 56 additions & 0 deletions pyvisgen/simulation/data_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@


def simulate_data_set(config, slurm=False, job_id=None, n=None):
"""
Wrapper function for simulating visibilities.
Distinction between slurm and non-threaded simulation.
Parameters
----------
config : toml file
path to config file
slurm : bool
True, if slurm is used
job_id : int
job_id, given by slurm
n : int
running index
"""
conf = read_data_set_conf(config)
out_path = Path(conf["out_path_fits"])
out_path.mkdir(parents=True, exist_ok=True)
Expand Down Expand Up @@ -54,6 +70,20 @@ def simulate_data_set(config, slurm=False, job_id=None, n=None):


def create_sampling_rc(conf):
"""
Draw sampling options and test if atleast half of the telescopes can see the source.
If not, then new parameters are drawn.
Parameters
----------
conf : dict
simulation options
Returns
-------
dict
contains the observation parameters
"""
samp_ops = draw_sampling_opts(conf)
array_layout = layouts.get_array_layout(conf["layout"][0])
half_telescopes = array_layout.x.shape[0] // 2
Expand All @@ -65,6 +95,19 @@ def create_sampling_rc(conf):


def draw_sampling_opts(conf):
"""
Draw observation options from given intervals.
Parameters
----------
conf : dict
simulation options
Returns
-------
dict
contains randomly drawn observation options
"""
angles_ra = np.arange(
conf["fov_center_ra"][0][0], conf["fov_center_ra"][0][1], step=0.1
)
Expand Down Expand Up @@ -127,6 +170,19 @@ def draw_sampling_opts(conf):


def test_opts(rc):
"""
Compute the number of telescopes that can observe the source given
certain randomly drawn parameters.
Parameters
----------
rc : dict
randomly drawn observational parameters
Returns
-------
"""
array_layout = layouts.get_array_layout(rc["layout"])
src_crd = SkyCoord(
ra=rc["fov_center_ra"], dec=rc["fov_center_dec"], unit=(un.deg, un.deg)
Expand Down
8 changes: 4 additions & 4 deletions pyvisgen/simulation/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def uncorrupted(lm, baselines, wave, time, src_crd, array_layout, SI):
source position
array_layout : dataclass
station information
I : 2d array
SI : 2d array
source brightness distribution / input img
Returns
Expand Down Expand Up @@ -248,7 +248,7 @@ def corrupted(lm, baselines, wave, time, src_crd, array_layout, SI, rd):
source position
array_layout : dataclass
station information
I : 2d array
SI : 2d array
source brightness distribution / input img
rd : 3d array
RA and dec values for every pixel
Expand Down Expand Up @@ -328,7 +328,7 @@ def corrupted(lm, baselines, wave, time, src_crd, array_layout, SI, rd):


def direction_independent(lm, baselines, wave, time, src_crd, array_layout, SI, rd):
"""Calculates direction independet visibility
"""Calculates direction independent visibility
Parameters
----------
Expand All @@ -344,7 +344,7 @@ def direction_independent(lm, baselines, wave, time, src_crd, array_layout, SI,
source position
array_layout : dataclass
station information
I : 2d array
SI : 2d array
source brightness distribution / input img
rd : 3d array
RA and dec values for every pixel
Expand Down
4 changes: 0 additions & 4 deletions pyvisgen/simulation/visibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ def vis_loop(rc, SI, num_threads=10, noisy=True):
)

visibilities.add(vis)
# workaround to guarantee min number of visibilities
# when num vis is below N sampling is redone
# if visibilities.get_values().shape[1] < 3500:
# return 0
del int_values
return visibilities

Expand Down
201 changes: 0 additions & 201 deletions scripts/cluster.py

This file was deleted.

0 comments on commit 5ae0bbc

Please sign in to comment.