Virtualization and real-time analysis of pharmaceutical and food products by near infrared spectroscopy