This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import functools | |
import types | |
import xarray as xr | |
@xr.register_dataarray_accessor("accessor_name") | |
class Something(xr.DataArray): | |
__slots__ = ( | |
"_cache", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[tool.poetry] | |
name = "neclib" | |
version = "0.3.1" | |
description = "My package" | |
authors = ["me"] | |
[tool.poetry.dependencies] | |
python = ">=3.6.1, <3.10" | |
astropy = [ | |
{ version = "^3.0", python = "<3.8" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__all__ = ["imshow_skewed"] | |
from typing import Tuple | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from matplotlib.transforms import Affine2D | |
from mpl_toolkits.axisartist import floating_axes | |
from mpl_toolkits.axisartist.grid_finder import DictFormatter, FixedLocator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import shutil | |
import subprocess | |
import sys | |
import time | |
from pathlib import Path | |
save_dir = Path.home() / "Downloads" / "to_upload" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_ros2_workspace() { | |
# Look up environment variables. | |
# If the value isn't actually a directory, this will create it. | |
candidate=($ROS2_WS $ROS_WS) | |
for __value in $candidate; do | |
if [ ! -z $__value ]; then | |
echo $__value | |
[ ! -d $__value ] && mkdir -p $__value | |
return 0 | |
fi |
OlderNewer