Русский New site

Advanced search

[ New messages · Forum rules · Members ]
Page 2 of 6«123456»
Forum » SpaceEngine » Mods and Addons » Tools and Utilities ... (... for working with Space Engine.)
Tools and Utilities ...
abrasaxDate: Wednesday, 16.03.2016, 07:19 | Message # 16
Space Tourist
Group: Users
Serbia
Messages: 33
Status: Offline
Quote FaceDeer ()
I also used a Gaussian probability distribution for most of the value ranges instead of a uniform one

This was on my mind as well but thought I should start with something simple first. I still prefer flash for this kind of thing because the user doesn't have to know how to run the code. You tell me what to add and I will do my best.

In theory it can generate anything with a pattern, you just have to explain well enough what you need. Adding rotation or comets is easy. Try to challenge me smile
 
JackDoleDate: Wednesday, 16.03.2016, 12:06 | Message # 17
Star Engineer
Group: Local Moderators
Germany
Messages: 1734
Status: Offline
Quote FaceDeer ()
Hope you don't mind,

Of course not. That's why I opened this thread. smile

The idea with the Gaussian probability distribution is good; pity that this is not occurred to me. sad wink

Parameters like 'RotationPeriod', 'Obliquity' and 'EqAscendNode' I have intentionally left off, SE produces these values themselves.
SE tide-locked the vulcanoid asteroid only because they are so close to the sun.
I think if they were to exist, they are surely tide-locked. For rings at a greater distance from the sun, the asteroids are not tide-locked.





Don't forget to look here.

 
quarior14Date: Wednesday, 16.03.2016, 12:16 | Message # 18
World Builder
Group: Users
Pirate
Messages: 640
Status: Offline
Very convenient software. In fact, you think that your script will generate a random system script ?




Quarior

Edited by quarior14 - Wednesday, 16.03.2016, 16:16
 
abrasaxDate: Wednesday, 16.03.2016, 12:20 | Message # 19
Space Tourist
Group: Users
Serbia
Messages: 33
Status: Offline
Quote quarior14 ()
Very convenient software. In fact, you think that your script will generate a random system script?Very convenient software. In fact, you think that your script will generate a random system script ?


If you are talking to me, this has crossed my mind. Is there a reason why this would be useful, considering SE already generates random systems?
 
quarior14Date: Wednesday, 16.03.2016, 13:06 | Message # 20
World Builder
Group: Users
Pirate
Messages: 640
Status: Offline
JackDole
U how do I work the lua file properly, I have download lua from file libaries but still nothing, I improperly installed?

Here's my Lua folder create :


abrasax
Quote abrasax ()
If you are talking to me, this has crossed my mind. Is there a reason why this would be useful, considering SE already generates random systems?

Yes this is may be not useful unless the system is binary because it create no planet and also to make the satellites around your planets. The fact I modified a bit your Python program for those who do not know the language, now they can directly entered from the 'Windows' window, here is the code :
Code
import random
from datetime import datetime

print("AsteroidsRingMaker by JackDole in 2016.03.15 16:36:56 converted to Python and enhanced by FaceDeer, edit by quarior14")

print("daysYear = 365.24218985 days \n1 AU = 149597870.691 km\n1 Mass Earth = 5.9736e24 kg")

#uncomment this line if you want repeatable results
#random.seed(100)

# Amount of asteroids
NumberOfAster=input("Number of aster : ")
NumberOfAster = int(NumberOfAster)
TypeOfAster=input("Type of aster : ")
ClassOfAster=input("Class of aster : ")

RingCenter=input("Ring center : ")
print("Name of the asteroids - a serial number is appended")
AsterName=input("Aster name (no space between name and number) : ")

# Orbital radii in AU
InnerRadius=input("Inner Radius in AU : ")
InnerRadius = float(InnerRadius)
OuterRadius=input("Outer radius in AU : ")
OuterRadius = float(OuterRadius)

# Radius of asteroids in KM
MaxRadiusOfAster = input("Max radius in km : ")
MaxRadiusOfAster = float(MaxRadiusOfAster)
MinRadiusOfAster = input("Min radius in km : ")
MinRadiusOfAster = float(MinRadiusOfAster)

#orbital eccentricity
MaxEccentricity = input("Max eccentricity : ")
MaxEccentricity = float(MaxEccentricity)
MinEccentricity = input("Min eccentricity : ")
MinEccentricity = float(MinEccentricity)
# Orbital inclination +- in degrees
MaxInclination = input("Max inclination in degrees : ")
MaxInclination = float(MaxInclination)

#Probability that the asteroid won't be given a rotation rate, leaving it tide-locked
ChanceOfTideLock = input ("Chance of tidal lock (between 0 and 1) : ")
ChanceOfTideLock = float(ChanceOfTideLock)
#rotation periods in hours. See https://www.boulder.swri.edu/~bottke/rubble/node3.html
MaxRotationPeriod = input("Max rotation period in hours : ")
MaxRotationPeriod = float(MaxRotationPeriod)
MinRotationPeriod = input("Min rotation period in hours : ")
MinRotationPeriod = float(MinRotationPeriod)

RefPlane=input("RefPlane (Ecliptic, Equator, Extrasolar) : ")
epoch=input("Epoch : ")
FileName= '{0}_{1}.sc'.format(AsterName, NumberOfAster)

template ="""
{TypeOfAster} "{AsterName}{count}"
{{
\tParentBody\t"{RingCenter}"
\tClass\t\t"{ClassOfAster}"
\tRadius\t\t{radius}\t//in km
{rotation}
\tOrbit
\t{{
\t\tEpoch\t\t\t{epoch}
\t\tSemiMajorAxis\t{semi}\t//in AU
\t\tEccentricity\t{eccen}
\t\tInclination\t\t{incl}\t//in degrees
\t\tAscendingNode\t{ascen}
\t\tArgOfPericen\t{argof}
\t\tMeanAnomaly\t\t0.0
\t\tRefPlane\t\t"{RefPlane}"
\t}}
}}

"""

#three different random number generators that give a floating point number between
#the two parameters but with different distributions

def uniform(a, b):
    return random.uniform(a, b)

def triangular(a, b):
    return random.triangular(a, b, (a+b)/2.0)

# A normal distribution placing a and b at three standard deviations out from the mean
# clamping the result so that there are no outliers beyond the desired range
def gaussian(a, b):
    result = random.gauss((a+b)/2.0, (b-a)/6.0)
    return max(min(result, b), a)

randomGenerator = gaussian

parameters = {'TypeOfAster' : TypeOfAster, 'AsterName' : AsterName, 'RingCenter' : RingCenter, 'ClassOfAster' : ClassOfAster, 'RefPlane' : RefPlane, 'epoch' : epoch}

with open(FileName, 'w') as outputfile:
    outputfile.write('// Asteroids made with AsteroidsRingMaker\n// {0}\n\n'.format(datetime.today()))

    for count in range(NumberOfAster):

        parameters['count'] = count+1
        parameters['semi'] = randomGenerator(InnerRadius, OuterRadius)
        parameters['radius'] = randomGenerator(MinRadiusOfAster, MaxRadiusOfAster)
        parameters['incl'] = randomGenerator(-MaxInclination, MaxInclination)
        parameters['eccen'] = randomGenerator(MinEccentricity, MaxEccentricity)
        parameters['argof'] = random.uniform(0,360)
        parameters['ascen'] = random.uniform(0,360)

        if random.random() > ChanceOfTideLock:
            rotation = randomGenerator(MinRotationPeriod,MaxRotationPeriod)
            obliquity = random.uniform(0,360)
            parameters['rotation'] = '\tRotationPeriod\t{0}\t//in hours\n\tObliquity\t\t{1}\n'.format(rotation, obliquity)
        else:
            parameters['rotation'] = '\t//RotationPeriod\tTidal locked'

        outputfile.write(template.format(**parameters))
print("The script is save in the file "+FileName+".")
os.system ("pause")

"Windows" window :

Attachments: 9458525.png(6Kb) · 0157676.png(8Kb) · asterringmaker.py(4Kb)





Quarior

Edited by quarior14 - Wednesday, 16.03.2016, 15:47
 
JackDoleDate: Wednesday, 16.03.2016, 14:57 | Message # 21
Star Engineer
Group: Local Moderators
Germany
Messages: 1734
Status: Offline
Quote quarior14 ()
I have download lua from file libaries but still nothing, I improperly installed?

I do not know that. It is probably sufficient for simple scripts.
My installation is larger. And an older version - 5.1.5 - that I can not update. My Celestia installations would then no longer function.
It is possible that the lcalc.lua script does not work properly with newer versions.





Don't forget to look here.

 
quarior14Date: Wednesday, 16.03.2016, 15:53 | Message # 22
World Builder
Group: Users
Pirate
Messages: 640
Status: Offline
Before I install lua, your AsterRingMaker.bat still worked but I wanted to download it to have the window you made - unless it is just a paint design but I think that not-.
Quote JackDole ()

Otherwise, how do you install ? I installe now and I give this :

But I don't know how to install because English is not a language I know perfectly and even with Google translate, I do not understand, he speaks of the file Makefile but what it is his extension, there is no basis ? And Readme it is .txt, I edited his extension.

Attachments: 0571270.png(10Kb)





Quarior

Edited by quarior14 - Wednesday, 16.03.2016, 16:01
 
JackDoleDate: Wednesday, 16.03.2016, 16:31 | Message # 23
Star Engineer
Group: Local Moderators
Germany
Messages: 1734
Status: Offline
quarior14,
look here:
Quote abrasax ()
http://abrasax.users.sbb.rs/seasteroidgen.swf
The image is from this Flash file. It has nothing to do with Lua.





Don't forget to look here.



Edited by JackDole - Wednesday, 16.03.2016, 16:34
 
quarior14Date: Wednesday, 16.03.2016, 16:52 | Message # 24
World Builder
Group: Users
Pirate
Messages: 640
Status: Offline
Quote JackDole ()
It has nothing to do with Lua.

Ah ok, sorry.





Quarior
 
abrasaxDate: Wednesday, 16.03.2016, 18:23 | Message # 25
Space Tourist
Group: Users
Serbia
Messages: 33
Status: Offline
Can someone write which bodies you want randomly generated and which parameters for those bodies need to be randomized. Also if it should be gaussian or uniform or something else.
 
quarior14Date: Wednesday, 16.03.2016, 19:13 | Message # 26
World Builder
Group: Users
Pirate
Messages: 640
Status: Offline
Quote abrasax ()
Can someone write which bodies you want randomly generated and which parameters for those bodies need to be randomized. Also if it should be gaussian or uniform or something else.

I am not an expert in Python (rather beginner) but I think that it is possible as you did with the rotation, except that it will be more difficult I think :
Code
if random.random() > ChanceOfLife:
            type = randomGenerator(0,1)
                 if type == 1
                     then Type = "Organic"
                     else Type = "Exotic"

            class = random.uniform(0,1)
            if class == 1
                     then Class = "Multicellular"
                     else Class = "Unicellular"
            biome = random.uniforme(0,15) #4^4 possibility = 16 - 1 = 15
            if biome == 15
                  then Biome = "Terrestrial/Marine/Subglacial/Floaters"
                  elif biome == 14
                      then Biome = "Terrestrial/Marine/Subglacial"
                  [...]
            parameters['life'] = '\Life\n{{\n\t\tType\t"{0}"\n\t\tClass\t"{1}"\n\t\tBiome\t"{2}\n\t}}".format(Type, Class, Biome)
        else:
            parameters['life'] = '\t//NoLife

I haven't test.





Quarior

Edited by quarior14 - Wednesday, 16.03.2016, 19:18
 
JackDoleDate: Wednesday, 16.03.2016, 19:27 | Message # 27
Star Engineer
Group: Local Moderators
Germany
Messages: 1734
Status: Offline
Okay, this is now my Python version.

I have some of the parameters that FaceDeer and quarior14 added, removed, because I consider them superfluous. SE generates these values themselves.
Parameters can be entered in the console, but at no input, default values are used.

Thanks to FaceDeer and quarior14.

Attachments: AsterRingMakerJ.py(5Kb)





Don't forget to look here.

 
FaceDeerDate: Wednesday, 16.03.2016, 20:46 | Message # 28
Space Pilot
Group: Users
Canada
Messages: 117
Status: Offline
Quote JackDole ()
Parameters like 'RotationPeriod', 'Obliquity' and 'EqAscendNode' I have intentionally left off, SE produces these values themselves.


SE tide-locks every asteroid I've ever come across, which actually isn't realistic. Small asteroids are subject to the YORP effect, in which solar radiation applies a torque that can cause small asteroids to spin up (even to the point where their rotation overcomes their gravity and they break apart - it's thought that some binary asteroids may form this way).

Some of the smaller outer moons of planets with large inner moons should also not be tide-locked, thanks to the tidal influence of other large inner moons they sometimes wind up with "chaotic" rotation that makes them wobble around unpredictably. Pluto's outer moons are good examples of this, the combination of Pluto and Charon's changing tidal forces make them gyrate all over the place. That's something that Space Engine will need to model itself, though.


Edited by FaceDeer - Wednesday, 16.03.2016, 20:46
 
JackDoleDate: Wednesday, 16.03.2016, 21:20 | Message # 29
Star Engineer
Group: Local Moderators
Germany
Messages: 1734
Status: Offline
Quote FaceDeer ()
Small asteroids are subject to the YORP effect, in which solar radiation applies a torque that can cause small asteroids to spin up (even to the point where their rotation overcomes their gravity and they break apart

How do you calculate that?
For example, calculate from the type of the sun, the size of asteroids and the distance from the sun, the rotation?





Don't forget to look here.

 
abrasaxDate: Wednesday, 16.03.2016, 21:46 | Message # 30
Space Tourist
Group: Users
Serbia
Messages: 33
Status: Offline
I guess the shape of the asteroid plays an important part, or I might be very wrong smile
 
Forum » SpaceEngine » Mods and Addons » Tools and Utilities ... (... for working with Space Engine.)
Page 2 of 6«123456»
Search: