Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions IB_collab_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from experiment_prototype.experiment_prototype import ExperimentPrototype
import borealis_experiments.superdarn_common_fields as scf
from experiment_prototype.decimation_scheme.decimation_scheme import \
from experiment_prototype.experiment_utils.decimation_scheme import \
DecimationScheme, DecimationStage, create_firwin_filter_by_attenuation


Expand Down Expand Up @@ -68,14 +68,12 @@ def __init__(self, **kwargs):
if kwargs:
if 'freq' in kwargs.keys():
freq = int(kwargs['freq'])
self.printing('Using frequency scheduled for {date}: {freq} kHz'
.format(date=datetime.datetime.utcnow().strftime('%Y%m%d %H:%M'), freq=freq))
print('Using frequency scheduled for {date}: {freq} kHz' # TODO: Log
.format(date=datetime.datetime.utcnow().strftime('%Y%m%d %H:%M'), freq=freq))
else:
self.printing('Frequency not found: using default frequency {freq} kHz'
.format(freq=freq))
print('Frequency not found: using default frequency {freq} kHz'.format(freq=freq)) # TODO: Log
else:
self.printing('Frequency not found: using default frequency {freq} kHz'
.format(freq=freq))
print('Frequency not found: using default frequency {freq} kHz'.format(freq=freq)) # TODO: Log

decimation_scheme = create_15km_scheme()

Expand All @@ -99,6 +97,7 @@ def __init__(self, **kwargs):
"acf": True,
"xcf": True, # cross-correlation processing
"acfint": True, # interferometer acfs
"decimation_scheme": decimation_scheme,
}

list_of_slices = [slice_1]
Expand All @@ -111,7 +110,7 @@ def __init__(self, **kwargs):
super().__init__(
cpid, txctrfreq=txctrfreq,
output_rx_rate=decimation_scheme.output_sample_rate,
rxctrfreq=rxctrfreq, decimation_scheme=decimation_scheme,
rxctrfreq=rxctrfreq,
comment_string='ICEBEAR, 5 beam, 2s integration, 15 km')

self.add_slice(slice_1)
2 changes: 1 addition & 1 deletion bistatic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self, **kwargs):
"freq": freq, # kHz
"scanbound": [i * 3.7 for i in range(len(scf.STD_16_BEAM_ANGLE))], # align each aveperiod to 3.7s boundary
"wait_for_first_scanbound": False,
"align_sequences": True # align start of sequence to tenths of a second
"align_sequences": True, # align start of sequence to tenths of a second
}

if 'listen_to' in kwargs.keys() and 'beam_order' in kwargs.keys(): # Mutually exclusive arguments
Expand Down
3 changes: 2 additions & 1 deletion borealis_paper.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def __init__(self):
"rx_beam_order": [0],
"tx_beam_order": [0],
"freq" : 13100,
"acf" : True
"acf" : True,

}

slice2 = copy.deepcopy(default_slice)
Expand Down
109 changes: 109 additions & 0 deletions eeaao.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#!/usr/bin/python

"""
eeaao
~~~~~~~~~~~~~
The mode is a flexible multistatic multifrequency full FOV mode.
Transmit and receive frequencies are configured via command line arguments.

:copyright: 2023 SuperDARN Canada
:author: Remington Rohel
"""
import copy

import borealis_experiments.superdarn_common_fields as scf
from experiment_prototype.experiment_prototype import ExperimentPrototype


class EEAAO(ExperimentPrototype):
"""
This experiment is configurable via arguments. The TX and RX frequencies in kHz must be specified by kwargs.
All TX frequencies specified will also be used as RX frequencies, and at least one frequency must be specified as
either an RX or TX frequency.
"""
def __init__(self, **kwargs):
"""
kwargs:
tx_freqs: str, list of frequencies in kHz to transmit on. Format as "[10500,12000]" or "10500,12000"
rx_freqs: str, list of frequencies in kHz to receive on. Format as "[10600,12200]" or "10600,12200"
"""
cpid = 3777

def parse_freqs_from_string(freqs):
freq_list = []
if freqs:
for f in freqs.strip('[]').split(','):
freq_list.append(int(f))
return freq_list

tx_freqs = parse_freqs_from_string(kwargs.get('tx_freqs', '')) # Default to no frequencies specified
rx_freqs = parse_freqs_from_string(kwargs.get('rx_freqs', '')) # Default to no frequencies specified

all_freqs = set(tx_freqs).union(set(rx_freqs))
if len(all_freqs) == 0:
raise ValueError(f"No RX or TX frequencies specified.\t"
f"tx_freqs: {kwargs.get('tx_freqs', '')}\t"
f"rx_freqs: {kwargs.get('rx_freqs', '')}")

if len(set(tx_freqs)) != len(tx_freqs):
raise ValueError(f"Duplicate TX frequencies specified: {tx_freqs}")
if len(set(rx_freqs)) != len(rx_freqs):
raise ValueError(f"Duplicate RX frequencies specified: {rx_freqs}")

# Calculate center frequency
max_freq = max(all_freqs)
min_freq = min(all_freqs)
center_freq = (max_freq + min_freq) / 2.0 # Center frequency set to middle of the range

comment_string = f"TX freqs: {tx_freqs}, RX freqs: {rx_freqs}"

super().__init__(cpid, txctrfreq=center_freq, rxctrfreq=center_freq, comment_string=comment_string)

default_slice = {
"pulse_sequence": scf.SEQUENCE_7P,
"tau_spacing": scf.TAU_SPACING_7P,
"pulse_len": scf.PULSE_LEN_45KM,
"num_ranges": scf.STD_NUM_RANGES,
"first_range": scf.STD_FIRST_RANGE,
"intt": scf.INTT_7P, # duration of an integration, in ms
"beam_angle": scf.STD_16_BEAM_ANGLE,
"rx_beam_order": [scf.STD_16_FORWARD_BEAM_ORDER], # All beams
"scanbound": [i * 3.7 for i in range(len(scf.STD_16_BEAM_ANGLE))], # align each aveperiod to 3.7s boundary
"wait_for_first_scanbound": False,
"align_sequences": True, # align start of sequence to tenths of a second
}

num_antennas = scf.options.main_antenna_count
left_half_antennas = [i for i in range(num_antennas // 2)]
right_half_antennas = [i for i in range(num_antennas // 2, num_antennas)]
all_antennas = [i for i in range(num_antennas)]

all_slices = []
for i, freq in enumerate(tx_freqs):
new_slice = copy.deepcopy(default_slice)
new_slice['freq'] = freq
new_slice['tx_antenna_pattern'] = scf.easy_widebeam
if len(tx_freqs) == 2: # Use 8-antenna wide-beam mode if only transmitting on two frequencies
if i == 0:
new_slice['tx_antennas'] = left_half_antennas
else:
new_slice['tx_antennas'] = right_half_antennas
else: # Use 16-antenna wide-beam mode otherwise
new_slice['tx_antennas'] = all_antennas
new_slice['tx_beam_order'] = [0]
new_slice['comment'] = f"TX slice with frequency {freq}"
all_slices.append(new_slice)

# Add the slices to the experiment
for freq in rx_freqs:
if freq in tx_freqs: # Already listening on this frequency, skip
continue
new_slice = copy.deepcopy(default_slice)
new_slice['freq'] = freq
new_slice['rxonly'] = True
new_slice['comment'] = f"RX slice with frequency {freq}"
all_slices.append(new_slice)

self.add_slice(all_slices[0])
for this_slice in all_slices[1:]:
self.add_slice(this_slice, {0: 'CONCURRENT'})
61 changes: 61 additions & 0 deletions epop2023.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/python
"""
Copyright SuperDARN Canada 2023
This mode was made for collaboration with the RRI instrument on the CASSIOPE satellite
by request of Dr. Kuldeep Pandey in February 2023.
"""

import numpy as np

import borealis_experiments.superdarn_common_fields as scf
from experiment_prototype.experiment_prototype import ExperimentPrototype


def boresight(frequency_khz, tx_antennas, antenna_spacing_m):
"""tx_antenna_pattern function for boresight transmission."""
num_antennas = scf.options.main_antenna_count
pattern = np.zeros((1, num_antennas), dtype=np.complex64)
pattern[0, tx_antennas] = 1.0 + 0.0j
return pattern


class Epop2023(ExperimentPrototype):
def __init__(self, **kwargs):
"""
kwargs:

freq: int, kHz

"""
cpid = 3813
super().__init__(cpid)

num_ranges = scf.STD_NUM_RANGES
if scf.options.site_id in ["cly", "rkn", "inv"]:
num_ranges = scf.POLARDARN_NUM_RANGES

# default frequency set here
freq = scf.COMMON_MODE_FREQ_1

if kwargs:
if 'freq' in kwargs.keys():
freq = int(kwargs['freq'])

print('Frequency set to {}'.format(freq))

slice_0 = { # slice_id = 0
"pulse_sequence": scf.SEQUENCE_7P,
"tau_spacing": scf.TAU_SPACING_7P,
"pulse_len": scf.PULSE_LEN_45KM,
"num_ranges": num_ranges,
"first_range": scf.STD_FIRST_RANGE,
"intt": 3500, # duration of an integration, in ms
"beam_angle": [0.0], # boresight only
"rx_beam_order": [0], # boresight only
"tx_beam_order": [0], # only one pattern
"tx_antenna_pattern": boresight,
"freq": freq, # kHz
"align_sequences": True, # align start of sequence to tenths of a second
}

self.add_slice(slice_0)
7 changes: 3 additions & 4 deletions epopsound.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ def __init__(self, **kwargs):
if 'marker_period' in kwargs.keys():
marker_period = int(kwargs['marker_period'])

self.printing('Freqs (kHz): {}, Start Beam: {}, Stop Beam: {}, '
'Marker Period: {}, '
.format(freqs, startbeam, stopbeam, marker_period))
print('Freqs (kHz): {}, Start Beam: {}, Stop Beam: {}, Marker Period: {}, ' # TODO: Log
.format(freqs, startbeam, stopbeam, marker_period))

if scf.options.site_id in ["cly", "rkn", "inv"]:
num_ranges = scf.POLARDARN_NUM_RANGES
Expand Down Expand Up @@ -84,7 +83,7 @@ def __init__(self, **kwargs):
"tx_beam_order": beams_to_use,
"acf": True,
"xcf": True,
"acfint": True
"acfint": True,
}

for freq in freqs:
Expand Down
9 changes: 3 additions & 6 deletions epopsound_one_beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ def __init__(self, **kwargs):
if 'marker_period' in kwargs.keys():
marker_period = int(kwargs['marker_period'])

self.printing('Freqs (kHz): {}, Beam: {}, '
'Marker Period: {}'
.format(freqs, beam, marker_period))
print('Freqs (kHz): {}, Beam: {}, Marker Period: {}'.format(freqs, beam, marker_period)) # TODO: Log

center_freq = int(sum(freqs)/len(freqs))

Expand All @@ -67,7 +65,7 @@ def __init__(self, **kwargs):
"beam_angle": scf.STD_16_BEAM_ANGLE,
"acf": True,
"xcf": True,
"acfint": True
"acfint": True,
}

for num, freq in enumerate(freqs):
Expand Down Expand Up @@ -95,8 +93,7 @@ def __init__(self, **kwargs):

slices.append(new_slice)

super().__init__(cpid=cpid, txctrfreq=center_freq, rxctrfreq=center_freq,
comment_string=Epopsound.__doc__)
super().__init__(cpid=cpid, txctrfreq=center_freq, rxctrfreq=center_freq, comment_string=Epopsound.__doc__)

self.add_slice(slices[0])
if len(slices) > 1:
Expand Down
2 changes: 1 addition & 1 deletion experiment_archive/normalscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# write an experiment that creates a new control program.
from experiment_prototype.experiment_prototype import ExperimentPrototype
from experiment_prototype.decimation_scheme.decimation_scheme import DecimationStage, DecimationScheme
from experiment_prototype.experiment_utils.decimation_scheme import DecimationStage, DecimationScheme
from borealis_experiments.test_decimation_schemes import *

class Normalscan(ExperimentPrototype):
Expand Down
2 changes: 1 addition & 1 deletion experiment_archive/test_decimation_schemes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import sys

from experiment_prototype.decimation_scheme.decimation_scheme import DecimationStage, DecimationScheme, \
from experiment_prototype.experiment_utils.decimation_scheme import DecimationStage, DecimationScheme, \
create_firwin_filter_by_num_taps, create_firwin_filter_by_attenuation


Expand Down
2 changes: 1 addition & 1 deletion experiment_archive/test_filters_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sys.path.append(os.environ['BOREALISPATH'])
# write an experiment that creates a new control program.
from experiment_prototype.experiment_prototype import ExperimentPrototype
from experiment_prototype.decimation_scheme.decimation_scheme import DecimationStage, DecimationScheme
from experiment_prototype.experiment_utils.decimation_scheme import DecimationStage, DecimationScheme
from borealis_experiments.test_decimation_schemes import *

class OneBox(ExperimentPrototype):
Expand Down
2 changes: 1 addition & 1 deletion experiment_archive/test_scheme_9.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sys.path.append(os.environ['BOREALISPATH'])
# write an experiment that creates a new control program.
from experiment_prototype.experiment_prototype import ExperimentPrototype
from experiment_prototype.decimation_scheme.decimation_scheme import DecimationStage, DecimationScheme
from experiment_prototype.experiment_utils.decimation_scheme import DecimationStage, DecimationScheme
from borealis_experiments.test_decimation_schemes import *

class TestScheme9(ExperimentPrototype):
Expand Down
2 changes: 1 addition & 1 deletion experiment_archive/test_scheme_9_acfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sys.path.append(os.environ['BOREALISPATH'])
# write an experiment that creates a new control program.
from experiment_prototype.experiment_prototype import ExperimentPrototype
from experiment_prototype.decimation_scheme.decimation_scheme import DecimationStage, DecimationScheme
from experiment_prototype.experiment_utils.decimation_scheme import DecimationStage, DecimationScheme
from borealis_experiments.test_decimation_schemes import *

class TestScheme9ACFs(ExperimentPrototype):
Expand Down
2 changes: 1 addition & 1 deletion experiment_archive/twofsound.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#import test
from experiment_prototype.experiment_prototype import ExperimentPrototype
from experiment_prototype.decimation_scheme.decimation_scheme import DecimationStage, DecimationScheme
from experiment_prototype.experiment_utils.decimation_scheme import DecimationStage, DecimationScheme
from borealis_experiments.test_decimation_schemes import *

class Twofsound(ExperimentPrototype):
Expand Down
4 changes: 2 additions & 2 deletions full_fov.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, **kwargs):
if 'freq' in kwargs.keys():
freq = kwargs['freq']

self.printing('Frequency set to {}'.format(freq))
print('Frequency set to {}'.format(freq)) # TODO: Log

num_antennas = scf.options.main_antenna_count

Expand All @@ -56,6 +56,6 @@ def __init__(self, **kwargs):
"acf": True,
"xcf": True, # cross-correlation processing
"acfint": True, # interferometer acfs
"align_sequences": True # align start of sequence to tenths of a second
"align_sequences": True, # align start of sequence to tenths of a second
})

7 changes: 4 additions & 3 deletions full_fov_15km.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import borealis_experiments.superdarn_common_fields as scf
from experiment_prototype.experiment_prototype import ExperimentPrototype
from experiment_prototype.decimation_scheme.decimation_scheme import \
from experiment_prototype.experiment_utils.decimation_scheme import \
DecimationScheme, DecimationStage, create_firwin_filter_by_attenuation


Expand Down Expand Up @@ -60,7 +60,7 @@ def __init__(self, **kwargs):
cpid = 3801
decimation_scheme = create_15km_scheme()

super().__init__(cpid, output_rx_rate=decimation_scheme.output_sample_rate, decimation_scheme=decimation_scheme,
super().__init__(cpid, output_rx_rate=decimation_scheme.output_sample_rate,
comment_string='Full FOV 15km Resolution Experiment')

num_ranges = scf.STD_NUM_RANGES * 3 # Each range is a third of the usual size, want same spatial extent
Expand All @@ -72,7 +72,7 @@ def __init__(self, **kwargs):
if 'freq' in kwargs.keys():
freq = kwargs['freq']

self.printing('Frequency set to {}'.format(freq))
print('Frequency set to {}'.format(freq)) # TODO: Log

num_antennas = scf.options.main_antenna_count

Expand All @@ -88,5 +88,6 @@ def __init__(self, **kwargs):
"tx_beam_order": [0], # only one pattern
"tx_antenna_pattern": scf.easy_widebeam,
"freq": freq, # kHz
"decimation_scheme": create_15km_scheme(),
})

Loading