Spectroscopic and TD-DFT studies on the dual mode fluorescent chemosensors based on pyrene thiosemicarbazones, and its application as molecular-scale logic devices