2018年10月31日水曜日

time lapse

飛行機の窓の風景をタイプラプスで撮影するのが楽しそうだったので自分でもやってみた。
そんだけ。




2018年9月21日金曜日

Rust & Neusiedlersee

ノイジードル湖というハンガリーとの国境にある湖に行ってきました。
最寄りの町の一つがRustというのですが、ワインで有名です。
Hauptbanhofから200番のバスで直通(途中Eisenstadtで285番に変わる)か、Eisenstadtで乗り換えです(285, 286)。
200番のバスが町中を走るような普通のバスなので、2時間かかることを考えるとちょっとシンドイ。
我々は帰りはEisenstadtで電車に乗り換えました。

Rustは街としては小さくて30分もあれば全部歩き回れるようなところですが、教会に登ったりワイナリーを巡ったりで一日時間を潰せます。
次回は是非泊まりたい。

レストランはワイナリー併設でホテルも経営してるらしい、Peter Schandlがイチオシ
(トリップアドバイザー)




Laplace's method

https://en.m.wikipedia.org/wiki/Laplace%27s_method

メモ。

2018年9月13日木曜日

xiaomi mi a1 + insta 360air

3Kビデオがコマ落ちするので、Samsung の良いSDカード買ってみたけど、どうも本体の性能(CPU?)が足りてないみたいで結局コマ落ちした。2.5Kで我慢。

Samsung EVO Plus Micro SDXC 128GB bis zu 100MB/s, Class 10 U3 Speicherkarte (inkl. SD Adapter) rot/weiß
by A-MONTAIN
Learn more: https://www.amazon.de/dp/B06XFHQGB9/ref=cm_sw_em_r_mt_dp_U_ptPMBbC1M0D7A

defaultdict

pythonで、list = [(a,1.0),(a,2.0),(b,3.0),(c,4.0)] のようなデータがあったときに、

a = [1.0, 2.0]
b = [3.0]
c = [4.0]
と整形したい。

from collections import defaultdict を使うときれいにかけて、

dict = defaultdic(list)
for i in list:
   dict[i[0]].append(i[1])

とやると、a, b, cがkeyになった辞書ができあがる。
naiveにやると二重ループになってlistが巨大なときに大変だし予めソートかけておくのも回りくどいので。




2018年9月10日月曜日

ヴァッハウ渓谷(メルク修道院+デュルンシュタイン)

日曜日に、ヴァッハウ渓谷に行ってきました。

westbanhofのカウンターでrail tours Wachau ticket (59 EUR)を購入。
Melk修道院のチケットと、MelkからKremsまでの船のチケット込。
9時20分発のREX1908でMelkまで行き、修道院+庭を散策。
13:50分の船でデュルンシュタインに向かう(途中下船)。
デュルンシュタインでは、城跡まで登る。(2つ登山口があって、我々はきつい方から登って、ゆるい方から降りてきた。ゆるい方なら割と整備はされているが、靴はしっかりしたものが必要。ゆっくり歩いて片道30分ぐらいが目安)
会社の同僚とばったり遭遇した。子供を遊ばせているんだと言っていたが、子連れで来て楽しい場所なのかな?という疑問はある。

17:50分の船でデュルンシュタインからクレムスに向かうが、船がかなり遅れた上、クレムスの船着き場から駅までがかなり遠いので狙っていた18:20の電車は逃す。
(バスで多分停留所2個分。ヘロヘロになってたとは言え10~20分ぐらいは歩いてたと思う)
結局19:14の電車でSt. Poeltenに行って乗り換えてWestbanhof到着。
Vapianoで夕食にして帰宅。


メルク修道院付属の庭。奥の建物でお茶をするべき。向かって右の部屋まで行くのが良い。

デュルンシュタインのお城跡で全方位カメラの撮影。
Google photoで閲覧

2018年9月3日月曜日

Miniconda(python2.7) + mod_wsgi on Centos6

Because the default python on Centos6 is too old, I need to use python2.7 for mapproxy.
so, I install miniconda2.
Mapproxy should work with apache, but using mod_wsgi with miniconda2 is a bit complicated.

I am describing a rough procedure:

% cd /opt/mapproxy
%  wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh
% sh Miniconda2-latest-Linux-x86_64.sh
(answer questions, “yes”, “/opt/mapproxy/miniconda2”, “no”)
% miniconda2/bin/pip install mod_wsgi
% miniconda2/bin/pip install mapproxy
% miniconda2/bin/mod_wsgi-express install-module
% vi /etc/httpd/conf/httpd.conf
LoadModule wsgi_module modules/mod_wsgi-py27.so

% chmod –R 755 /opt/mapproxy/miniconda2/

Some other configs:
WSGIScriptAlias /mapproxy /opt/mapproxy/config.py
WSGIPythonHome /opt/mapproxy/miniconda2/
WSGIApplicationGroup %{GLOBAL}
WSGISocketPrefix /var/run/wsgi
WSGIDaemonProcess mysite python-path=/opt/mapproxy/miniconda2/lib/python2.7/site-packages

cache elevation data of world wind java using mapproxy

I finally find a way to cache the elevation data of world wind java with mapproxy.
Old version of mapproxy did not handle tiff 16bit, and mapproxy-1.11 with pillow-5.2 do.

Keypoints:
1. get elevation tiles in image/tiff
2. store the tiles in image/png, mode I
3. deliver the tiles in image/ppm

==mapproxy.yaml==
layers:
  - name: Elev
    title: NASA_SRTM30_900m_Tiled in TIFF
    sources: [Elev_cache]

caches:
  Elev_cache:
    sources: [Elev_wms]
    format: png16
    request_format: image/tiff
    grids: ['Elev_grid']
    image:
      resampling_method: bicubic
    cache:
       type: sqlite
       directory: /opt/mapproxy/cache/elev


sources:
   Elev_wms:
      type: wms
      supported_srs: ['EPSG:4326']
      wms_opts:
        version: 1.3.0
      req:
         url: https://worldwind26.arc.nasa.gov/elev
         layers: NASA_SRTM30_900m_Tiled

grids:
  Elev_grid:
    srs: EPSG:4326
    num_levels: 12
    origin: nw

globals:
  # image/transformation options
  image:
      paletted: False
      formats:
         png16:
            format: image/png
            mode: I
==end mapproxy.yaml==

And EarthElevations2.xml  can be used with the changes:
        <ImageFormat>image/ppm</ImageFormat>
        <DataType type="Int16" byteOrder="LittleEndian"/> 
        <FormatSuffix>.ppm</FormatSuffix>

2018年8月31日金曜日

Julia

この投稿が面白かったので、Juliaの練習を兼ねてちょっと遊んで見る。
https://twitter.com/solove_math/status/1035480802144833536

==ここからコード==
using Plots

function func2(n)
      return [1.0/(2.0*Float64(n) - 1.0),-1.0/(4.0*Float64(n) - 2.0) ,-1.0/(4.0*Float64(n)) ]
end

function func1(n)
      return [1.0/(2.0*Float64(n) - 1.0),-1.0/(2.0*Float64(n) )]
end

function main()

   n = 60
   y = 0.0
   y2= 0.0
   arr_y = zeros(Float64,n, 2)
   #arr_x = zeros(Int64,n)
   arr_x = 1:n
   for i in 1:n/2
      y = func1(i)
      arr_y[2*Int64(i)-1,1]= y[1]
      arr_y[2*Int64(i)  ,1]= y[2]
   end
   for i in 1:n/3
      y = func2(i)
      arr_y[3*Int64(i)-2,2]= y[1]
      arr_y[3*Int64(i)-1,2]= y[2]
      arr_y[3*Int64(i)  ,2]= y[3]
   end
   for i in 2:n
      arr_y[i,1]= arr_y[i,1] + arr_y[i-1,1]
      arr_y[i,2]= arr_y[i,2] + arr_y[i-1,2]
   end

   plt = plot(arr_x,arr_y)
   gui(plt)
   readline()
end


main()
==ここまでコード==


2018年8月22日水曜日

NASA's servers with worldwindjava 1.5.1 on Linux

At least JDK-10.0.2 can communicate https servers of NASA, but older versions do not.
As far as I can see there are problems regarding SSL on older versions of JAVA.
If you are struggling with https connection, please try to use new versions.

2018年7月20日金曜日

tele-lens 問題解決

googleカメラを使うための設定をするとtele-lens (x2 zoom lens)が使えなくなる問題解決。
純正カメラアプリのoptionからマニュアルモードでteleレンズを選択すると、強制的に切り替えられる。


2018年7月17日火曜日

preload in mapproxy

mapproxyは予めキャッシュをダウンロードしておいて、レスポンスを高めることができるみたい。

seedの項目参照。

https://mapproxy.org/docs/nightly/seed.html

2018年5月25日金曜日

lubuntuでウィンドウを縦方向に最大化

.config/openbox/lubuntu-rc.xml

<keyboard>セクションに、

<keybind key="W-A-h"> <action name="ToggleMaximizeVert"/></keybind>
を追加。

Windows key + Alt + hがキーバインド

2018年3月26日月曜日

octaveのfft

配列の長さで規格化されている。
キチンと書いてあるドキュメントがなかったのでここに記す。

(FFTWの結果を配列の長さ、二次元ならnx * ny、で割る)

2018年3月16日金曜日

openmp offloading のメモ

llvm clangがgpuのoffloadingに対応してるっぽいので確かめている。
上手く行ってないけど。
テスト用のコードをメモ。
#include<stdlib.h>
#include<stdio.h>
#include<omp.h>

int main(){

   int i;
   int N=100000;
   float *vec;
   float sum=0.0;

   int isDevInit = -1;
#pragma omp target map(from:isDevInit)
{
   isDevInit = omp_is_initial_device();
}

if (!isDevInit) {
   printf("run on acc. %d\n",isDevInit);
}

   vec=(float *)malloc(sizeof(float)*N);
   for(i=0;i<N;i++){
      vec[i] = (float)i;
   }
#pragma omp target map(to:vec) map(tofrom:sum)
{
   fprintf(stdout,"num dev %d\n",omp_get_num_devices());
#pragma omp parallel for reduction(+:sum)
   for(i=0;i<N;i++){
      sum += vec[i];
   }
}
   fprintf(stdout,"sum: %e\n",sum);

   free(vec);

}

2018年3月15日木曜日

flang 4.0 (メモ)

https://github.com/flang-compiler/flang/blob/master/README.md
で特に問題ない。

https://libcxx.llvm.org/docs/BuildingLibcxx.html
libc++, libc++abiも一緒にコンパイルしているのでclangインストール後は
setenv CXX "clang++ -stdlib=libc++"
してlibc++を使わないとopenmpがコンパイルできない

2018年2月26日月曜日

PEZYに対する間違った指摘

元社長が税金が元になった研究ファンドを横領したせいか、PEZYに対しては技術的に間違った指摘をして悦に入っている人がちらほらいる。

たとえばこのブログ
https://note.mu/rings/n/n29283c5afed5
なんだけど、速攻でご本人に反論されてたり、
http://numericalbrain.org/ja/2018/02/comment-on-the-note/

同じサイトの
https://note.mu/rings/n/ne8b5a691940c
にある、

(a) (2) は開発者である牧野淳一郎氏,田中英行氏のツイートとは反対の主張です.(2) はアプリケーションを表すモデルが線形方程式から微分方程式に移行し,後者が大部分を占めるようになったことで,HPL の測定結果が過去のものになったという,根拠のある説明になっています.

は、少しでも微分方程式をコンピューターを使って解くことを自分でやってみた/習ったなら絶対出てこない文章だし、とにかく叩きたいということしか読み取れない。

叩きやすいところをひたすら叩き続けるのが最近の日本という感じなので、みんなが忘れるまでは続くのかもしれない。

2018年2月25日日曜日

2018年2月15日木曜日

Xiaomi A1でGoogle Camera (rootとかとったりしなくていいし OTAも問題ないはず)

ややこしいことしなくても、adbを使って設定を書き換えればなんとかなった。

ほぼ、この通り。ただ、Windowsだと上手くADBでデバイスを認識してくれなかったので、Linuxからやった。
https://forum.xda-developers.com/showpost.php?p=75541654&postcount=98

22日追記:
これやると、純正のカメラでもx2ズームにもう一個のレンズを使わなくなる。
Google cameraのほうが重要度高いのでこのままでいくけれど。

xiaomi a1でphotosphere

なぜだか知らないが、xiaomi mi a1はcamera2 apiなどなどが有効になっていなくて、camera nxが動かない。
rootをとったりすれば良いらしいが、私の端末では
https://www.technobuzz.net/root-mi-a1-oreo/
http://c.mi.com/thread-676390-1-1.html
こういうのが上手くいかなかった(magisk managerが凍ってしまう)

結局、古いバージョンのgoogle cameraのapkを公開してくれてる人がいて、それをインストールした。
http://c.mi.com/thread-608791-1-0.html

HDR+を使いたい気もするが、とりあえず。

Xiaomiがこの辺整備してくれればいちばん簡単なんだが。

====追記====
と思ったら、まともに動かなかった。残念。

octave 4.2.1 with mkl

CPPFLAGS=' -I${MKLROOT}/include -I${MKLROOT}/include/fftw' \
LDFLAGS=' -L${MKLROOT}/lib/intel64' \
CFLAGS="-O3 -fPIC -DM_PI=3.1415926535897932384  -I${MKLROOT}/include -I${MKLROOT}/include/fftw" \
F77="gfortran" \
./configure --prefix=/path/to/install \
--with-blas="-lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -liomp5 -lpthread" \
--with-lapack="-lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -liomp5 -lpthread" \
--with-fftw3="-lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -liomp5 -lpthread -lm" \
--with-fftw3f="-lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -liomp5 -lpthread -lm" \
--disable-java --enable-static

めも。