# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# ## Diagnostics for drift correction

# ### Configure environment

# +
import os
os.chdir("/home/hbabcock/Data/storm_analysis/sa_diagnostics/drift_correction")
print(os.getcwd())

import numpy
numpy.random.seed(1)
# -

import storm_analysis.diagnostics.drift_correction.settings as settings
import storm_analysis.diagnostics.drift_correction.configure as configure
import storm_analysis.diagnostics.drift_correction.make_data as makeData
import storm_analysis.diagnostics.drift_correction.analyze_data as analyzeData
import storm_analysis.diagnostics.drift_correction.collate as collate


# ### Configure

configure.configure()

# ### Make Data

makeData.makeData()

# ### Analyze data

# %time analyzeData.analyzeData()

# ### Reference results

# + active=""
# ...
#
# Analysis complete
# Analysis completed in 183.81 seconds.
#
# ...
#
# Analysis complete
# Analysis completed in 179.50 seconds.
#
# 2 directories analyzed in 363.31 seconds.
# CPU times: user 5min 52s, sys: 11.7 s, total: 6min 4s
# Wall time: 6min 3s
# -

# ### Collate data

collate.collate()

# ### Reference results

# + active=""
# 2019-10-30
# commit <PASSWORD>
#
# Drift correction RMS error (nanometers):
#   drift_xy.txt
#    X 1.247
#    Y 1.473
#    Z 0.570
#
#   drift_xyz.txt
#    X 1.452
#    Y 1.502
#    Z 1.834

StarcoderdataJupyterScriptsDedupFiltered