I am trying to embed a full Jupyter notebook here… it should be more or less auto-explicative. Please comment if you need help!
Ok, so now: what new nice prime lens should I buy?
Exploring your DT database¶
Copy (for safety) your db:
cp $HOME/.config/darktable/library.db dtlibrary.db
These are the available tables:
sqlite> .tables
color_labels history mask tagged_images
db_info images meta_data used_tags
film_rolls legacy_presets selected_images
First of all, you load the database and save the tables you need in csv
format.
See for example http://www.sqlitetutorial.net/sqlite-tutorial/sqlite-export-csv/
sqlite3 dtlibrary.db
SQLite version 3.22.0 2018-01-22 18:45:57
Enter ".help" for usage hints.
sqlite> .headers on
sqlite> .mode csv
sqlite> .output images.csv
sqlite> select * from images;
sqlite> .quit
In [1]:
# sources
# https://songhuiming.github.io/pages/2017/04/02/jupyter-and-pandas-display/
#
import sys
import os
# BEWARE only for command line interactive usage
from math import *
import scipy as sp
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
pd.set_option('display.height', 10)
pd.set_option('display.max_rows', 8)
pd.set_option('display.max_columns', 10)
pd.set_option('display.width', 80)
In [2]:
allphotos = pd.read_csv("images.csv")
In [3]:
allphotos
Out[3]:
In [4]:
allphotos.columns
Out[4]:
Fix the database¶
A lot of entries for OLYMPUS are bad. I fix this here, but you can fix the database also with
check: select * from images where maker like "%OLYMPUS%" and crop=0;
change: update images set crop=2 where maker like "%OLYMPUS%" and crop=0;
In [5]:
allphotos.loc[(allphotos.maker=="OLYMPUS CORPORATION")&(allphotos.crop==0), 'crop']=2
In [6]:
allphotos['FLeq35'] = allphotos.crop * allphotos.focal_length
In [7]:
FLseries = allphotos[allphotos.FLeq35>0].FLeq35
In [8]:
FLs=np.array(FLseries)
In [9]:
FLs
Out[9]:
In [10]:
plt.hist(FLs, bins =[0,20,40,60,80,120,200,500])
Out[10]:
Let’s try to separate them based on camera¶
In [11]:
cam_and_fl = allphotos[allphotos.FLeq35>0].loc[:, ['model', 'FLeq35']]
In [12]:
cam_and_fl
Out[12]:
In [13]:
models = cam_and_fl.model.unique(); models
Out[13]:
In [14]:
from matplotlib.ticker import ScalarFormatter
for i, mymod in enumerate(['SLT-A55V', 'DMC-LX5', 'DMC-TZ100',
'E-M1MarkII']):
fig, axs = plt.subplots(nrows=1, figsize=(5,3.5))
thisfls=cam_and_fl[cam_and_fl.model==mymod].FLeq35
L=np.array(thisfls)
axs.set_xscale("log")
axs.xaxis.set_major_formatter(ScalarFormatter())
axs.set_title(mymod)
axs.set_xticks([15, 24, 35, 50, 70, 100, 140, 200, 300])
axs.hist(L, bins =np.logspace(np.log10(10), np.log10(400), 20 ))
Leave a Reply