public void calcTMmodeEffectiveRefractiveIndices(){
        this.effectiveRefractiveIndicesTM = new double[this.numberOfTMmeasurementsGrating];
        this.effectiveErrorsTM = new double[this.numberOfTMmeasurementsGrating];

        if(!this.setSuperstrateRI){
            this.superstrateRI = RefractiveIndex.air(super.wavelength);
            super.superstrateRefractiveIndex = RefractiveIndex.air(super.wavelength);
        }

        if(this.setTMerrors){
            ErrorProp superRI = new ErrorProp(super.superstrateRefractiveIndex, 0.0D);
            ErrorProp pitch = new ErrorProp(this.gratingPitch, 0.0D);
            ErrorProp lambda = new ErrorProp(super.wavelength, 0.0D);

            for(int i=0; i<this.numberOfTMmeasurementsGrating; i++){
                ErrorProp theta = new ErrorProp(this.anglesRadTM[i], this.errorsRadTM[i]);
                ErrorProp order = new ErrorProp((double)this.gratingOrderTM[i], 0.0D);
                ErrorProp calc = ErrorProp.sin(theta);
                calc = calc.times(superRI);
                calc = calc.plus(lambda.times(order).over(pitch));
                this.effectiveRefractiveIndicesTM[i] = calc.getValue();
                this.effectiveErrorsTM[i] = calc.getError();
           }
           super.enterTMmodeData(this.thicknessesTM, this.effectiveRefractiveIndicesTM, this.effectiveErrorsTM, this.modeNumbersTM);
        }
        else{
            for(int i=0; i<this.numberOfTMmeasurementsGrating; i++){
                this.effectiveRefractiveIndicesTM[i] = this.superstrateRI*Math.sin(this.anglesRadTM[i]) + super.wavelength*this.gratingOrderTM[i]/this.gratingPitch;
            }
            super.enterTMmodeData(this.thicknessesTM, this.effectiveRefractiveIndicesTM, this.modeNumbersTM);
        }
        this.calcEffectiveDone = true;
    }