雑多な技術系メモ

自分用のメモ。内容は保証しません。よろしくお願いします。

2018-12-01から1ヶ月間の記事一覧

【tex】 表に斜線をいれる方法

tex

slashbox.styを用いる。 以下のサイトからダウンロードできる https://ctan.org/tex-archive/macros/latex/contrib/slashbox \usepackage{slashbox} \backslashbox{A}{B} 参考 https://www.biwako.shiga-u.ac.jp/sensei/kumazawa/tex/slashbox.html

【SUMO】現在のPhaseの残り時間の取得

# tlidは信号機のid time = traci.trafficlight.getNextSwitch(tlid) - traci.simulation.getCurrentTime() print(time)

SUMOでスクリーンショットを撮る

# スクリーンショット用↲ ids = traci.gui.getIDList() traci.gui.screenshot(ids[0],"test.pdf")

matplotlibで凡例をグラフ外の右上に出す

サンプルコード 省略 plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0) # 右上に出す plt.subplots_adjust(left = 0.1, right = 0.7) # ここで、図がキャンバス内に収まるように調整する

pythonのElementTree(xmlファイル)で編集して、きれいに(改行をうまくして)保存する方法

サンプルコード from xml.dom import minidom 省略 xmlstr = minidom.parseString(ET.tostring(root)).toprettyxml(indent=" ") with open("xml.xml", "w") as f: f.write(xmlstr) 参考 https://stackoverflow.com/questions/28813876/how-do-i-get-pythons-…

【keras】keras のモデルの保存と読み込み

モデルの保存 # モデルの保存 json_model = model.to_json() with open("model.json", "w") as f json.dump(text, f) # パラメータの保存 model.save_weights("param.hdf5") 保存したモデルの読み込み from keras.models import model_from_json # モデルの…

【python】【xml】すでにあるxmlに要素を追加

サンプルコード import xml.etree.ElementTree as ET tree = ET.ElementTree(file="file.xml") # xmlを読み込む root = tree.getroot() element = ET.Element("vType") # 要素の作成 element.set("A", "a") # 属性の追加 root.insert(0, element) # 作成した…

sumoの信号機のoffsetについてのメモ

まずは、信号機の設定が記述してあるファイル net.xml <tlLogic id="1/2" type="static" programID="0" offset="2">↲ <phase duration="33" state="GGGggrrrrrGGGggrrrrr"/>↲ <phase duration="3" state="yyyggrrrrryyyggrrrrr"/>↲ <phase duration="6" state="rrrGGrrrrrrrrGGrrrrr"/>↲ <phase duration="3" state="rrryyrrrrrrrryyrrrrr"/>↲ </phase></phase></phase></phase></tllogic>

texで目次をいれる

tex

サンプルコード \begin{document} \tableofcontents % 目次の表示 \section{}