Skip to content

Instantly share code, notes, and snippets.

View KaoruNishikawa's full-sized avatar

Kaoru Nishikawa KaoruNishikawa

View GitHub Profile
@KaoruNishikawa
KaoruNishikawa / padded_array.py
Last active June 24, 2021 15:21
Create np.ndarray from ragged nested lists.
from typing import Any
import numpy as np
def padded_array(list_: list, padval: Any = np.nan) -> np.ndarray:
"""Make np.array from ragged nested lists.
Convert list of any dimension into an np.array with no ragged parts.
[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
[tool.poetry.dependencies]
python = "^3.7"
matplotlib = "^3.3.2"
astropy = "^4.1"
numpy = "^1.19.4"
#!/usr/bin/env python3
"""
Get board temperature
via UDP in IPv4 (SOCK_DGRAM)
from "localhost:16210"
send it to "xffts_board##" and "xffts_power_board##" topics
Get spectral data
via TCP in IPv4 (SOCK_STREAM)
from "localhost:25144"
from astropy.coordinates import SkyCoord, EarthLocation, Angle
from astropy.time import Time
from datetime import datetime
def get_lst(location, hemisphere='n'):
"""Not precise.
Parameters
----------
location: astropy.coordinates.EarthLocation
Location of observer.
from typing import Union, Type, Any
def base_expand(clss: Union[list, Type[Any]]) -> list:
"""
Parameters
----------
clss: class or list of classes
Any class you want to know the base classes.