function assisted_database_epoch_quality_check(filenomen)
%may 15, 2007

%as listed in the database, these are the five parameters that have to be checked for any epoch to be suitable for analysis:
% 1) R_acc is stable and not too high -- human check
% 2) no runup/down; seal quality good -- human check
% 3) presyn I_Na present all pulses all trials -- automated check
% 4) same #columns (& in register) for psc, ctrl, raw, crit, I_Na -- automated check
% 5) as far as known mechanical stability good, perfusion good, no other issues -- automated check

%first query the database for any C or WC or I epochs from stdp expts, excluding 'neg' epochs, or do this manually

%then take each file of each epoch and load the I_Na, check for all present (incl for inductions?)

ina=load(strcat('H:\extracted_values_modulebayHD\',filenomen,'__presyn_I_Na_array')),inacols=size(ina,2)

if min(min(ina)),disp('sodium current DETECTED all APs'),end
disp(min(min(ina)))

%then load the psc class, ctrl, raw and crit files, make sure they all have the same number of columns as the I_Na check file
pscclass=load(strcat('H:\extracted_values_modulebayHD\',filenomen,'__pre-postPSC'));pscclasscols=size(pscclass,2)
ctrl=load(strcat('H:\extracted_values_modulebayHD\',filenomen,'__controls'));ctrlcols=size(ctrl,2)
crit=load(strcat('H:\extracted_values_modulebayHD\',filenomen,'__criterion_vals'));critcols=size(crit,2)
raw=load(strcat('H:\extracted_values_modulebayHD\',filenomen,'____raw'));rawcols=size(raw,2)/2 %raw has two cols per trial


if find(inacols~=[pscclasscols ctrlcols rawcols critcols]), error('quatsch'),end
    

%then mark epoch_free_of_significant_technical_problems as zero or 1
input('did you mark epoch_free_of_significant_technical_problems as zero or 1?')

%if this epoch is marked as 1 and the next epoch is marked as 1, determine whether next_C_epoch_if_C_epoch_and_epochs_can_be_compared;...
%if so put the name of the next C epoch in the box
input('did you put the name of the next C epoch in next_C_epoch_if_C_epoch_and_epochs_can_be_compared?')