Skip to content

Commit

Permalink
Parset options and lofar temp
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanLoh committed Jun 11, 2024
1 parent 73f6cce commit ea8cfaa
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 9 deletions.
16 changes: 16 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@
pygments_style = 'sphinx'


# Napoleon settings
# napoleon_google_docstring = True
# napoleon_numpy_docstring = True
# napoleon_include_init_with_doc = False
# napoleon_include_private_with_doc = False
# napoleon_include_special_with_doc = True
# napoleon_use_admonition_for_examples = False
# napoleon_use_admonition_for_notes = False
# napoleon_use_admonition_for_references = False
# napoleon_use_ivar = False
# napoleon_use_param = False
# napoleon_use_rtype = False
# napoleon_preprocess_types = False
# napoleon_type_aliases = None
# napoleon_attr_annotations = True

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand Down
2 changes: 1 addition & 1 deletion nenupy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
__copyright__ = "Copyright 2023, nenupy"
__credits__ = ["Alan Loh"]
__license__ = "MIT"
__version__ = "2.7.2"
__version__ = "2.7.3"
__maintainer__ = "Alan Loh"
__email__ = "[email protected]"

Expand Down
54 changes: 53 additions & 1 deletion nenupy/instru/instrument_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"instrument_temperature",
"miniarrays_rotated_like",
"read_cal_table",
"generate_nenufar_subarrays"
"generate_nenufar_subarrays",
"lofar_instrument_temperature"
]


Expand Down Expand Up @@ -356,3 +357,54 @@ def generate_nenufar_subarrays(
# ============================================================= #
# ============================================================= #

# ============================================================= #
# --------------- lofar_instrument_temperature ---------------- #
# ============================================================= #
def lofar_instrument_temperature(frequency: u.Quantity) -> u.Quantity:
"""_summary_
From Vlad Kondratiev lofar_tinst.py (polynomial fit on Wijnholds (2011))
Parameters
----------
frequency : u.Quantity
_description_
Returns
-------
u.Quantity
_description_
"""
lba_mask = frequency <= 90*u.MHz
hba_mask = frequency >= 110*u.MHz
t_inst_poly_fit_coeff_lba = np.array(
[
6.2699888333e-05,
-0.019932340239,
2.60625093843,
-179.560314268,
6890.14953844,
-140196.209123,
1189842.07708
]
)
t_inst_poly_fit_coeff_hba = np.array(
[
6.64031379234e-08,
-6.27815750717e-05,
0.0246844426766,
-5.16281033712,
605.474082663,
-37730.3913315,
975867.990312
]
)
t_inst_poly_fit_lba = np.poly1d(t_inst_poly_fit_coeff_lba)
t_inst_poly_fit_hba = np.poly1d(t_inst_poly_fit_coeff_hba)

instrument_temperature = np.empty(frequency.shape)
instrument_temperature[lba_mask] = t_inst_poly_fit_lba(frequency[lba_mask].to_value(u.MHz))
instrument_temperature[hba_mask] = t_inst_poly_fit_hba(frequency[hba_mask].to_value(u.MHz))
instrument_temperature[~(lba_mask + hba_mask)] = np.nan
return instrument_temperature * u.K
# ============================================================= #
# ============================================================= #
2 changes: 1 addition & 1 deletion nenupy/observation/parset.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ def add_observation_metadata(self, observation: _ParsetProperty, parset_file: st
}
topic = observation.get('topic', 'LT00 DEBUG')
# Try to capture code and topic name using regular expression
pattern = r'^(?P<code>(ES([0]?[0-9]|1[0-7])|LT(?!08)([0]?[0-9]|1[0-3])|RP1[A-C]|SP(16|17))) (?P<name>\w+)$'
pattern = r'^(?P<code>(ES([0]?[0-9]|1[0-7])|LT(?!08)([0]?[0-9]|1[0-3])|RP\d+[A-Z]|SP(16|17))) (?P<name>\w+)$'
topic_decoded = re.match(pattern=pattern, string=topic)
if topic_decoded is None:
log.warning(f'{topic} not properly decoded!!')
Expand Down
12 changes: 6 additions & 6 deletions nenupy/observation/parset_user_options.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
"transitDate": {
"required": false,
"value": "2021-01-01T00:00:00Z",
"syntax": "^20[1-2][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T(0[0-9]|1[1-9]|2[0-4]):[0-5][0-9]:[0-5][0-9]Z$"
"syntax": "^20[1-2][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T(0[0-9]|1[0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9]Z$"
},
"decal_transit": {
"required": false,
Expand Down Expand Up @@ -201,7 +201,7 @@
"startTime": {
"required": true,
"value": "2021-01-01T00:00:00Z",
"syntax": "^20[1-2][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T(0[0-9]|1[1-9]|2[0-4]):[0-5][0-9]:[0-5][0-9]Z$"
"syntax": "^20[1-2][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T(0[0-9]|1[0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9]Z$"
},
"duration": {
"required": true,
Expand Down Expand Up @@ -280,7 +280,7 @@
"transitDate": {
"required": false,
"value": "2021-01-01T00:00:00Z",
"syntax": "^20[1-2][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T(0[0-9]|1[1-9]|2[0-4]):[0-5][0-9]:[0-5][0-9]Z$"
"syntax": "^20[1-2][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T(0[0-9]|1[0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9]Z$"
},
"decal_transit": {
"required": false,
Expand Down Expand Up @@ -320,7 +320,7 @@
"startTime": {
"required": false,
"value": "2021-01-01T00:00:00Z",
"syntax": "^20[1-2][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T(0[0-9]|1[1-9]|2[0-4]):[0-5][0-9]:[0-5][0-9]Z$"
"syntax": "^20[1-2][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T(0[0-9]|1[0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9]Z$"
},
"duration": {
"required": false,
Expand Down Expand Up @@ -401,7 +401,7 @@
"transitDate": {
"required": false,
"value": "2021-01-01T00:00:00Z",
"syntax": "^20[1-2][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T(0[0-9]|1[1-9]|2[0-4]):[0-5][0-9]:[0-5][0-9]Z$"
"syntax": "^20[1-2][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T(0[0-9]|1[0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9]Z$"
},
"decal_transit": {
"required": false,
Expand Down Expand Up @@ -431,7 +431,7 @@
"startTime": {
"required": false,
"value": "2021-01-01T00:00:00Z",
"syntax": "^20[1-2][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T(0[0-9]|1[1-9]|2[0-4]):[0-5][0-9]:[0-5][0-9]Z$"
"syntax": "^20[1-2][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T(0[0-9]|1[0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9]Z$"
},
"duration": {
"required": false,
Expand Down

0 comments on commit ea8cfaa

Please sign in to comment.