<jupyter_start><jupyter_text>Import<jupyter_code>%pylab inline
%load_ext watermark
%load_ext autoreload
%autoreload 2
%load_ext blackcellmagic

import os
from glob import glob
import pandas as pd
import numpy as np
from pandas import set_option
set_option('display.max_rows', 30)
from pathlib import Path
from scipy import integrate
import Process_interim
import Imaging
from datetime import datetime,timedelta,date,time

from uncertainties import ufloat
from uncertainties import umath
from uncertainties.umath import *
%watermark -a '<NAME>' -d -t -v -p numpy
project = "3.4.9"<jupyter_output><empty_output><jupyter_text>Light values   Illuminance<jupyter_code>Process_interim.Elsec_ill(project)<jupyter_output>Data to be processed !<jupyter_text>Irradiance<jupyter_code>Process_interim.Logbox_irr(project)<jupyter_output><empty_output><jupyter_text>RS<jupyter_code>cd/home/gus/Documents/PhD/PhD_Projects/Part3_MFT_Application/3.4_MFT-external/3.4.9_Inktime_Frank/Data/Interim/RS/To_process
# we import all the txt file
path = os.getcwd()
files_path = os.listdir(path)
files = [f for f in files_path if f[-3:] == 'txt']

dir_path = '/home/gus/Documents/PhD/PhD_Projects/Part3_MFT_Application/3.4_MFT-external/3.4.9_Inktime_Frank/Data/Processed/RS/'


# run the script to export the rawdata and process them
Process_interim.RS(files,dir_path,project, light_level='init')
file = glob('**')[0]

df = pd.read_csv(file, index_col='parameter')
sp = pd.to_numeric(df['380':]['value1'])
files
(df.loc['wavelength_nm']['value1'])
df['380':]<jupyter_output><empty_output><jupyter_text>AIS<jupyter_code>cd /home/gus/Documents/PhD/PhD_Projects/Part2_Paint_&_colour_technology/2.6_Window-exp/Data/Interim/AIS/To_process
files = sorted(glob('*'))

# run the script to export the rawdata and process them
Process_interim.AIS_mean(files, project)<jupyter_output><empty_output><jupyter_text>Images<jupyter_code>cd /home/gus/Documents/PhD/PhD_Projects/Part2_Paint_&_colour_technology/2.6_Window-exp/Data/Interim/Photos/To_process<jupyter_output>/home/gus/Documents/PhD/PhD_Projects/Part2_Paint_&_colour_technology/2.6_Window-exp/Data/Interim/Photos/To_process<jupyter_text>Flatfield<jupyter_code>files = glob('*TIF*')
im_white = glob('*background*')
im_obj = list(set(files)-set(im_white))

Imaging.flat_fielding(im_obj,im_white[0])<jupyter_output><empty_output><jupyter_text>ICC profile<jupyter_code>cd /home/gus/Documents/PhD/PhD_Projects/Part2_Paint_&_colour_technology/2.6_Window-exp/Data/Interim/Photos
import pyvips
from pathlib import Path

def icc_transform(files,dir_path):
    date = files[0].split('_')[1]    
    
    output_profile = '/home/gus/Documents/PhD/PhD_Projects/Docs/profiles/eci_RGBv2.icc'
        
    input_profile_file = glob(f'*{date}*icc*')[0]    
    input_profile = Path(input_profile_file).resolve()
    input_profile = str(input_profile)

    for im_file in files:
        im = pyvips.Image.new_from_file('To_process/' + im_file, access = 'sequential')
        im_lab = im.icc_transform(output_profile, embedded=False, input_profile=input_profile, depth=8)
        
        #if im_lab.has_alpha:
        #    im_lab = im_lab.flatten(background = [128, 255, 128])
        
        filename = im_file.replace('flatfield','corr')
        im_lab.write_to_file(dir_path+filename)
        
        os.remove('To_process/' + im_file)
files = os.listdir('/home/gus/Documents/PhD/PhD_Projects/Part2_Paint_&_colour_technology/2.6_Window-exp/Data/Interim/Photos/To_process')
dir_path = '/home/gus/Documents/PhD/PhD_Projects/Part2_Paint_&_colour_technology/2.6_Window-exp/Data/Processed/Photos/'

icc_transform(files,dir_path)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12319038514067195, 'fraction_numerical': 0.01666211417645452, 'mean_word_length': 6.055876685934489, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 32, '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}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '335964', 'license': 'Apache-2.0', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1370, 'n_words': 189, 'path': 'notebooks/2_Process_interimdata.ipynb', 'repo_name': 'g-patin/inktime', 'size': '3669'}