<commit_before>#!/usr/bin/python3

import argparse
import os
import pyexiv2                  # dnf install python3-exiv2 (py3exiv2)
import sys

from props import getNode       # from aura-props package
import props_json               # from aura-props package

sys.path.append('../lib')
import Camera

parser = argparse.ArgumentParser(description='New camera configuration.')
parser.add_argument('--config', default='../cameras', help='camera config directory')
parser.add_argument('--ccd-width', required=True, type=float)
parser.add_argument('--image', required=True, help='sample image from this camera with exif tags')
parser.add_argument('--force', action='store_true', help='force overwrite of an existing config file')

args = parser.parse_args()

exif = pyexiv2.ImageMetadata(args.image)
exif.read()

make = exif['Exif.Image.Make'].value
model = exif['Exif.Image.Model'].value
if 'Exif.Photo.LensModel' in exif:
    lens_model = exif['Exif.Photo.LensModel'].value
else:
    lens_model = 'unknown'
focal_len_mm = exif['Exif.Photo.FocalLength'].value
width = exif['Exif.Photo.PixelXDimension'].value
height = exif['Exif.Photo.PixelYDimension'].value

base_name = (make + "_" + model + "_" + lens_model).replace(' ', '_')
print('base:', base_name)
<commit_msg>Update library import location.<commit_after>#!/usr/bin/python3

import argparse
import os
import pyexiv2                  # dnf install python3-exiv2 (py3exiv2)
import sys

from props import getNode       # from aura-props package
import props_json               # from aura-props package

from lib import Camera

parser = argparse.ArgumentParser(description='New camera configuration.')
parser.add_argument('--config', default='../cameras', help='camera config directory')
parser.add_argument('--ccd-width', required=True, type=float)
parser.add_argument('--image', required=True, help='sample image from this camera with exif tags')
parser.add_argument('--force', action='store_true', help='force overwrite of an existing config file')

args = parser.parse_args()

exif = pyexiv2.ImageMetadata(args.image)
exif.read()

make = exif['Exif.Image.Make'].value
model = exif['Exif.Image.Model'].value
if 'Exif.Photo.LensModel' in exif:
    lens_model = exif['Exif.Photo.LensModel'].value
else:
    lens_model = 'unknown'
focal_len_mm = exif['Exif.Photo.FocalLength'].value
width = exif['Exif.Photo.PixelXDimension'].value
height = exif['Exif.Photo.PixelYDimension'].value

base_name = (make + "_" + model + "_" + lens_model).replace(' ', '_')
print('base:', base_name)

{'fraction_non_alphanumeric': 0.1430264717502963, 'fraction_numerical': 0.005531410509679968, 'mean_word_length': 4.794050343249428, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3067217', 'n_tokens_mistral': 812, 'n_tokens_neox': 803, 'n_words': 182}