I wanted to understand, for the Altitude Detector to work, do we need to have Keplerian Orbit only or would it work for a Cartesian Orbit? If so, how do I setup the code for that?
The tutorials provided for the usage of Altitude Detector are for a Keplerian Orbit case.
All detectors work with all orbit types.
Which tutorials do you refer to ? I did not find any reference to altitude detector in the tutorials.
Nevertheless, the configuration should be the same regardless of the propator type and orbit type. When a propagator (Keplerian, numerical, DSST, analytical…) is configured with an initial orbit (Keplerian, Circular, Cartesian, Equinoctial) it can accept any detector using the addEventDetector because it is declared for all propagators.
So you just register the detector to the propagator and then call the propagate method.
Is it safe to say that the way it is shown in the above test script for Keplerian orbit, the same way can be employed for Altitude Detector Implementation for a Cartesian Orbit?
You can use any kind of orbit, be it equinoctial, circular, keplerian or cartesian. They are all sub classes of the abstract Orbit class behind the scenes.