diff --git a/docs/conf.py b/docs/conf.py index 6b03c94..f4ee8fc 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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 diff --git a/nenupy/__init__.py b/nenupy/__init__.py index 70a2283..6dc4fda 100644 --- a/nenupy/__init__.py +++ b/nenupy/__init__.py @@ -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__ = "alan.loh@obspm.fr" diff --git a/nenupy/instru/instrument_tools.py b/nenupy/instru/instrument_tools.py index 9c7d2ff..d23b15c 100644 --- a/nenupy/instru/instrument_tools.py +++ b/nenupy/instru/instrument_tools.py @@ -22,7 +22,8 @@ "instrument_temperature", "miniarrays_rotated_like", "read_cal_table", - "generate_nenufar_subarrays" + "generate_nenufar_subarrays", + "lofar_instrument_temperature" ] @@ -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 +# ============================================================= # +# ============================================================= # diff --git a/nenupy/observation/parset.py b/nenupy/observation/parset.py index a1100b8..0dea0a3 100644 --- a/nenupy/observation/parset.py +++ b/nenupy/observation/parset.py @@ -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(ES([0]?[0-9]|1[0-7])|LT(?!08)([0]?[0-9]|1[0-3])|RP1[A-C]|SP(16|17))) (?P\w+)$' + pattern = r'^(?P(ES([0]?[0-9]|1[0-7])|LT(?!08)([0]?[0-9]|1[0-3])|RP\d+[A-Z]|SP(16|17))) (?P\w+)$' topic_decoded = re.match(pattern=pattern, string=topic) if topic_decoded is None: log.warning(f'{topic} not properly decoded!!') diff --git a/nenupy/observation/parset_user_options.json b/nenupy/observation/parset_user_options.json index f6779c8..4091fe0 100644 --- a/nenupy/observation/parset_user_options.json +++ b/nenupy/observation/parset_user_options.json @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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,