Coder Social home page Coder Social logo

Comments (15)

KingShark1 avatar KingShark1 commented on July 19, 2024 1

ok, i'll make a PR, but the location(latitude and longitude) data is important, would you resolve that for me?

also i am a student from India, trying for GSoC 2021, just to let you know

from orbitdeterminator.

hornig avatar hornig commented on July 19, 2024

I added some already. some more need to be finished.
https://github.com/aerospaceresearch/orbitdeterminator/tree/Positional_Obs_Report_Formats

from orbitdeterminator.

grubdragon avatar grubdragon commented on July 19, 2024

Hi! Is this issue still open?
i'm a newbie, where should I start?

from orbitdeterminator.

KingShark1 avatar KingShark1 commented on July 19, 2024

Is the issue still open ?

from orbitdeterminator.

hornig avatar hornig commented on July 19, 2024

It is open as long as we do not close it.
So feel free to add more and make it more elegant.

from orbitdeterminator.

KingShark1 avatar KingShark1 commented on July 19, 2024

I was looking into the issue, found that for the conversion to work, four variables are required, namely : elevation, azimuth, UTC time and finally Latitude.

the data provided would already contain three of them excluding Latitude, as latitude would be of the observing station, it would be required to calculate the siderial time and also both of elevation and azimuth.

here is the code taken from
https://github.com/aerospaceresearch/orbitdeterminator/tree/Positional_Obs_Report_Formats
and modified
def load_iod_data(fname):
""" Loads satellite position observation data files following the Interactive
Orbit Determination format (IOD). Currently, the only supported angle format
are 1,2,3&7, as specified in IOD format.
IOD format is described at http://www.satobs.org/position/IODformat.html.
TODO: convert IOD angle formats 4,5&6 from AZ/EL to RA/DEC.
Args:
fname (string): name of the IOD-formatted text file to be parsed
Returns:
x (numpy array): array of satellite position observations following the
IOD format, with angle format code = 2.
"""
import math

      # dt is the dtype for IOD-formatted text files
      dt = 'S15, i8, S1, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, S8, S7, i8, i8, S1, S1, i8, i8, i8'
      
      # iod_names correspond to the dtype names of each field
      iod_names = ['object', 'station', 'stationstatus',
                      'yr', 'month', 'day',
                      'hr', 'min', 'sec', 'msec', 'timeM', 'timeX',
                      'angformat', 'epoch',
                      'raaz', 'decel', 'radecazelM', 'radecazelX',
                      'optical', 'vismagsign', 'vismag', 'vismaguncertainty', 'flashperiod']
      
      # iod_delims corresponds to the delimiter for cutting the right variable from each input string
      iod_delims = [15, 5, 2,
                      5, 2, 2,
                      2, 2, 2, 3, 2, 1,
                      2, 1,
                      8, 7, 2, 1,
                      2, 1, 3, 3, 9]
      
      iod_input_lines = np.genfromtxt(fname, dtype=dt, names=iod_names, delimiter=iod_delims, autostrip=True)
      
      def horizon_to_celestial(ele, al, utc, lat):
          """ele : elevation
              al : altitude
              AZ/EL  = DDDMMSS+DDMMSS MX   (MX in seconds of arc)
              st : siderial time
              lat: latitude
              returns right_ascension and declination in order
          """
          #todo convert utc to siderial_time(ST)
          ELE = math.radians(ele)
          AL = math.radians(al)
          LAT = math.radians(lat)
          ST = math.radians(-1*utc)
          
          sin_dec = (math.sin(LAT)*math.sin(ELE)) + (math.cos(LAT)*math.cos(ELE)*math.cos(AZ))
          dec = math.degrees(math.asin(sin_dec))
      
          cos_HA = (math.sin(ELE) - math.sin(LAT)*sin_dec)/(math.cos(LAT)*math.cos(math.asin(sin_dec)))
          HA = math.degrees(math.acos(cos_HA))
          #if the object is west of observer's meridian
          if():
              ra = ST - HA
          #if the object is east of observer's meridian
          else:
              ra = ST + HA
      
          return ra, dec
      
      right_ascension = []
      declination = []
      azimuth = []
      elevation = []
      
      for i in range(len(iod_input_lines)):
      
          RA = -1.0
          DEC = -1.0
          AZ = -1.0
          EL = -1.0
      
          if iod_input_lines["angformat"][i] == 1:
              # 1: RA/DEC = HHMMSSs+DDMMSS MX   (MX in seconds of arc)
              RAAZ = iod_input_lines["raaz"][i].decode()
              HH = float(RAAZ[0:2])
              MM = float(RAAZ[2:4])
              SS = float(RAAZ[4:6])
              s = float(RAAZ[6])
              RA = (HH + (MM + (SS + s / 10.0) / 60.0) / 60.0) / 24.0 * 360.0
      
              DECEL = iod_input_lines["decel"][i].decode()
              DD = float(DECEL[1:3])
              MM = float(DECEL[3:5])
              SS = float(DECEL[5:7])
              DEC = DD + (MM + SS / 60.0) / 60.0
              if DECEL[0] == "-":
                  DEC = -1.0 * DEC
      
          elif iod_input_lines["angformat"][i] == 2:
              # 2: RA/DEC = HHMMmmm+DDMMmm MX   (MX in minutes of arc)
              RAAZ = iod_input_lines["raaz"][i].decode()
              HH = float(RAAZ[0:2])
              MM = float(RAAZ[2:4])
              mmm = float(RAAZ[4:7])
              RA = (HH + (MM + mmm / 1000.0) / 60.0) / 24.0 * 360.0
      
              DECEL = iod_input_lines["decel"][i].decode()
              DD = float(DECEL[1:3])
              MM = float(DECEL[3:5])
              mm = float(DECEL[5:7])
              DEC = DD + (MM + mm / 100.0) / 60.0
              if DECEL[0] == "-":
                  DEC = -1.0 * DEC
      
          elif iod_input_lines["angformat"][i] == 3:
              # 3: RA/DEC = HHMMmmm+DDdddd MX   (MX in degrees of arc)
              RAAZ = iod_input_lines["raaz"][i].decode()
              HH = float(RAAZ[0:2])
              MM = float(RAAZ[2:4])
              mmm = float(RAAZ[4:7])
              RA = (HH + (MM + mmm / 1000.0) / 60.0) / 24.0 * 360.0
      
              DECEL = iod_input_lines["decel"][i].decode()
              DD = float(DECEL[1:3])
              dddd = float(DECEL[3:7])
              DEC = (DD + (dddd / 1000.0))
              if DECEL[0] == "-":
                  DEC = -1.0 * DEC
      
          elif iod_input_lines["angformat"][i] == 4:
              # 4: AZ/EL  = DDDMMSS+DDMMSS MX   (MX in seconds of arc)
              RAAZ = iod_input_lines["raaz"][i].decode()
              DDD = float(RAAZ[0:3])
              MM = float(RAAZ[3:5])
              SS = float(RAAZ[5:7])
              AZ = DDD + (MM + SS / 60.0) / 60.0
      
              DECEL = iod_input_lines["decel"][i].decode()
              DD = float(DECEL[1:3])
              MM = float(DECEL[3:5])
              SS = float(DECEL[5:7])
              EL = DD + (MM + SS / 60.0) / 60.0
              if DECEL[0] == "-":
                  EL = -1.0 * EL
              UTC = float()
              # TODO: convert from AZ/EL to RA/DEC
              RA, DEC = horizon_to_celestial(EL, AZ, UTC, LAT)
      
          elif iod_input_lines["angformat"][i] == 5:
              # 5: AZ/EL  = DDDMMmm+DDMMmm MX   (MX in minutes of arc)
              RAAZ = iod_input_lines["raaz"][i].decode()
              DDD = float(RAAZ[0:3])
              MM = float(RAAZ[3:5])
              SS = float(RAAZ[5:7])
              AZ = DDD + (MM + SS / 60.0) / 60.0
      
              DECEL = iod_input_lines["decel"][i].decode()
              DD = float(DECEL[1:3])
              MM = float(DECEL[3:5])
              mm = float(DECEL[5:7])
              EL = DD + (MM + mm / 100.0) / 60.0
              if DECEL[0] == "-":
                  EL = -1.0 * EL
      
              # TODO: convert from AZ/EL to RA/DEC
              RA, DEC = horizon_to_celestial(EL, AZ, UTC, LAT)
      
          elif iod_input_lines["angformat"][i] == 6:
              # 6: AZ/EL  = DDDdddd+DDdddd MX   (MX in degrees of arc)
              RAAZ = iod_input_lines["raaz"][i].decode()
              DDD = float(RAAZ[0:3])
              dddd = float(RAAZ[3:7])
              AZ = DDD + dddd / 1000.0
      
              DECEL = iod_input_lines["decel"][i].decode()
              DD = float(DECEL[1:3])
              dddd = float(DECEL[3:7])
              EL = DD + dddd / 1000.0
              if DECEL[0] == "-":
                  EL = -1.0 * EL
              
              # TODO: convert from AZ/EL to RA/DEC
              RA, DEC = horizon_to_celestial(EL, AZ, UTC, LAT)
      
          elif iod_input_lines["angformat"][i] == 7:
              # 7: RA/DEC = HHMMSSs+DDdddd MX   (MX in degrees of arc)
              RAAZ = iod_input_lines["raaz"][i].decode()
              HH = float(RAAZ[0:2])
              MM = float(RAAZ[2:4])
              SS = float(RAAZ[4:6])
              s = float(RAAZ[6])
              RA = (HH + (MM + (SS + s / 10.0) / 60.0) / 60.0) / 24.0 * 360.0
      
              DECEL = iod_input_lines["decel"][i].decode()
              DD = float(DECEL[1:3])
              dddd = float(DECEL[3:7])
              DEC = (DD + (dddd / 1000.0))
              if DECEL[0] == "-":
                  DEC = -1.0 * DEC
      
          #else:
          #    # TODO: when not defined, we assume it is RA/DEC
      
          right_ascension.append(RA)
          declination.append(DEC)
          azimuth.append(AZ)
          elevation.append(EL)
      
      # expanding the input iod data with the position data in different formats
      iod = {}
      for name in iod_names:
              iod[name] = iod_input_lines[name].tolist()
      
      iod["right_ascension"] = right_ascension
      iod["declination"] = declination
      iod["azimuth"] = azimuth
      iod["elevation"] = elevation
      
      return iod

from orbitdeterminator.

hornig avatar hornig commented on July 19, 2024

Hi, okay, cool.

Why not making a PR out of all your efforts?

It's also easier to read.
It's easier to see changes.
And we can test it with your branch.

Will you?

from orbitdeterminator.

hornig avatar hornig commented on July 19, 2024

ok, i'll make a PR, but the location(latitude and longitude) data is important, would you resolve that for me?

also i am a student from India, trying for GSoC 2021, just to let you know

It latitude longitude stuff is implemented in the already working part. I think you can just do it similarly. You should test your code anyways and see, if it works :).
I will help of course, so doing a PR into the iod branch would be a good start. Then we can work together on this.

And I expected you to be a gsoc student. ;) We have a lot of new activity lately about it.
If you did not do it already, come into our zulip chat for further chats.

from orbitdeterminator.

KingShark1 avatar KingShark1 commented on July 19, 2024

should i make a new branch for this?
@hornig

from orbitdeterminator.

hornig avatar hornig commented on July 19, 2024

@KingShark1 you can use the branch for the report formats.

from orbitdeterminator.

KingShark1 avatar KingShark1 commented on July 19, 2024

@hornig can you check up on the changes i made?
here's a link to my forked repo
https://github.com/KingShark1/orbitdeterminator

from orbitdeterminator.

hornig avatar hornig commented on July 19, 2024

@KingShark1 your link is broken (underneath) and on the visible side it links to your repo.
it would help me to see the change you did by either providing a link to your change/commit, or you just directly commit it as a PR to this branch https://github.com/aerospaceresearch/orbitdeterminator/tree/Positional_Obs_Report_Formats

Will have a look then. :)

from orbitdeterminator.

KingShark1 avatar KingShark1 commented on July 19, 2024

yeah did that!
please update me soon : )
also, there's a bunch of gibberish stuff, due to my vsc enviorment, and a testing file(somethingsomething.py), ignore those two :)

from orbitdeterminator.

hornig avatar hornig commented on July 19, 2024

would be good if you remove it :)
in the end it needs to run on your computer first :).

from orbitdeterminator.

nomaan-2k avatar nomaan-2k commented on July 19, 2024

Hey @hornig
I worked on AZ/EL to RA/DEC conversion part of this issue. I have made changes on the master branch.
To create a PR, should I make a new branch as this branch is quite old ( structure differs a bit from the current master branch ).
Or can I create a PR on the master??

from orbitdeterminator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.