---placed analysis folder mkdir before opening diag file.