title: Hindu astrology - Problems with programming ascendant
body: <p>I am working on a Hindu astrology software using PySwissEph which is a python library developed using <a href="http://www.astro.com/swisseph/swephinfo_e.htm" rel="nofollow noreferrer">SwissEphemeris</a> I am faced with a dilemma I can't solve. <strong>The code is functional, but the ascendant is often determined to be incorrect</strong> this is in comparison to other software such as <a href="http://www.saravali.de/maitreya.html" rel="nofollow noreferrer">Maitreya</a>. I have posted the parts of the code I feel are relative but can post more if needed.</p>
  
  <p>Edit * The ascendant is not accurate, it appears to have entire Zodiac sign differences in comparison to working software. </p>
  
  <pre><code>### SET SID MODE
  set_ayanamsa_mode = lambda: swe.set_sid_mode(swe.SIDM_TRUE_CITRA, 0, 0)
  set_ayanamsa_mode()
  </code></pre>
  
  <p>Above is the Ayanamsha to use  </p>
  
  <pre><code>### TIMEZONE INFORMATION
  tz = timezone(zone)
  timecheck = tz.localize(datetime(year, month, day, hour, minute, 0))
  </code></pre>
  
  <p>Above is to convert the timezone using pytz</p>
  
  <pre><code>jd = swe.utc_to_jd(timecheck.year, timecheck.month, timecheck.day, timecheck.hour, timecheck.minute, 0.1, 1)
  jd = float(jd[1])
  </code></pre>
  
  <p>Above is swisseph function to convert utc time to a julian day</p>
  
  <pre><code>#ayan = swe.calc_ut(jd, swe.ECL_NUT)[0]
  ayanamsa = swe.get_ayanamsa_ut(jd) #+ float(ayan)
  </code></pre>
  
  <p>I am not 100% certain about this code (Above). I have been experimenting for quite some time</p>
  
  <pre><code>### ASCENDANT
  ascDeg = float(swe.houses_ex(jd, lat, lon, 'E', flag = swe.FLG_SWIEPH | swe.FLG_SIDEREAL | swe.FLG_SPEED)[0][4])
  ascDeg = ascDeg - ayanamsa
  
  if ascDeg &lt; 0:
      360 + ascDeg
  
  ascSign = int(ascDeg / 30) + 1
  </code></pre>
  
  <p>Above is the code to calculate the ascendant. The 'E' flag represents the use of the Equal house system in SwissEphemeris. </p>
  
  <p>I appreciate any guidance given concerning this programming task. Thank you :-)</p>