@oliof said in IDEX XY calibration by electrical nozzle contact:
@NeoDue great stuff! You should consider some way to filter out outliers in your 8 runs (use median or just track lowest/highest and reject runs where the difference is greater than some value you deem an acceptable range).
@oliof Now I finally had the time to dust off and actually use a bit of my old statistics knowledge... Got it 🙂 - here is a test macro that removes outliers from a given array based on their z-score:
; constraints out of experience: ; - electrical nozzle contact never gets activated too soon (=> too low values will never happen and are not taken into account here) ; if that does not apply, a lower acceptance limit for the z-score needs to be defined as well ; - values that are too high are usually at least 0.15...0.2mm off var Referenzwert = {1,1.02,1.05,1.2,1.22,1.3,1.01,} ; test values - the three values that are too high need to be detected and removed from the mean value var Referenzmittelwert = 0.0 var Referenzstandardabw = 0.0 var ReferenzZScore = vector(#var.Referenzwert,null) var ZScoregrenze = 0.5 var Anzahlgueltig = 0 ; calculate mean value while iterations < #var.Referenzwert set var.Referenzmittelwert = var.Referenzmittelwert + var.Referenzwert[iterations] set var.Referenzmittelwert = var.Referenzmittelwert / #var.Referenzwert ; calculate standard deviation while iterations < #var.Referenzwert set var.Referenzstandardabw = var.Referenzstandardabw + (var.Referenzwert[iterations] - var.Referenzmittelwert) * (var.Referenzwert[iterations] - var.Referenzmittelwert) set var.Referenzstandardabw = sqrt(var.Referenzstandardabw / (#var.Referenzwert - 1)) ; calculate z-score of each measurement value while iterations < #var.Referenzwert set var.ReferenzZScore[iterations] = (var.Referenzwert[iterations] - var.Referenzmittelwert) / var.Referenzstandardabw ; re-calculate mean value without detected outliers set var.Referenzmittelwert = 0 while iterations < #var.Referenzwert if var.ReferenzZScore[iterations] < var.ZScoregrenze set var.Referenzmittelwert = var.Referenzmittelwert + var.Referenzwert[iterations] set var.Anzahlgueltig = var.Anzahlgueltig + 1 set var.Referenzmittelwert = var.Referenzmittelwert / var.Anzahlgueltig echo var.ReferenzmittelwertWhile I do not use that for XY calibration (at least yet - that one works perfectly well as it is so far...), I did add it to the two macros I wrote for z calibration and z-leveling of the U axis relative to the X axis. It definitely makes sense there since slight drops of filament coming out of the nozzle can cause errors.