Determining system types in script? |

I want to make Basic Sensors grant bonus research points to Astronomy and Biology in black-hole and organic-infestation systems respectively, but I can't seem to find the script function to determine a system's type. Is there such a function or am I on a wild goose chase?
Thanks! 



