I just added the 40+ ephemeris from the actionscript you posted earlier and was able to debug my script a bit. I forgot to convert the data from CSV to floating point number, the previous script just read the data as text and won’t work so I fixed it in this post.
The D variable I was using was being used by Blenders Python console so I renamed it to DD. I did have to alter the R distance to 400, I didn’t change the magnatude. I also made each sphere have a lower amount of verts. If you toss 20,000 stars at the script it will create 20,000 spheres just as you wanted in your first post. Each sphere is 58 verts right now so that will be a about 1.1 million verts if you run this new script as is. I may be able to get it lower but I’ll have to wait for the actual csv file from you.
If you still have the origional yale V4 files and have the program to convert the star data I would realy recomend also putting the star name into the csv output and alter the script to name each sphere, I was only able to get the V5 data. In order to get image data you will need to add some support in the script for lighting the stars.
Below the code window is the starData.csv file I ran my tests with.
# BrightStarData_CSV.py V2
#
# place this file in C:\blender-2.73-windows32\2.73\Python\lib
#
#
# MIT License
#
# Copyright (c) 2012-2015 Jorge Joaquin Pareja
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
# substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
'''
A Blender python library for reading star data.
For more information see http://blenderartists.org/forum/showthread.php?359731
'''
import csv # for CSV files
import math #
import bpy # for blender
##########
# declare some variables global to this scripts functions
i = 0 # for iterating some loops
x = 0.0
y = 0.0
z = 0.0
numStars = 0 # set the number of stars to be zero
magnatude = [] # a list with each stars magnatude
RA = [] # a list with each stars Right Ascention
DD = [] # a list with each stars Declination
##########
# define some functions we can call later, the three single quotes are for
# help about the function when called with help(functionName).
def clearVars():
'''
Clear this scripts global variables to defaults
this is automaticaly called by:
readStarData()
'''
i = 0
numStars = 0
x = 0.0
y = 0.0
z = 0.0
magnatude = []
RA = []
DD = []
def readStarData(file):
'''
Opens a star data file with the following format
Magnatude, RA, D
file indicates the full path and name to the file to read
'''
# clear all variables by calling the clearVars function
clearVars()
numLines = 0
# open the given file to read in all data
with open(file, newline='') as f:
# setup reader for comma delimited file
reader = csv.reader(f, delimiter=',', quoting=csv.QUOTE_NONE)
# for each line in the file, break the rows into the proper parts
# populating the magnatude, RA, and D variables
for row in reader:
magnatude.append(float(row[0]))
RA.append(float(row[1]))
DD.append(float(row[2]))
numLines += 1 # keep track, globaly, of how many stars there are
return numLines -1
def processStars():
# we are using numStars to create a seperate object for each star
# using spheres. We can use the magnatude data to tell blender how
# large to make each sphere.
#
#
#
i = 0
while i != numStars:
# math from post http://blenderartists.org/forum/showthread.php?359731&p=2802867&viewfull=1#post2802867
#
x = 0.0
y = 0.0
z = 0.0
#
R = 400 # in meters for this test, if stars are too close this will need to be higher
x = R * math.cos(DD[i]) * math.cos(RA[i])
y = R * math.cos(DD[i]) * math.sin(RA[i])
z = R * math.sin(DD[i])
# add an object at this x,y,z location
bpy.ops.mesh.primitive_uv_sphere_add(location=(x, y, z), size=magnatude[i], segments=8, ring_count=8)
i += 1 # incriment i and go to start of while until we are done
###################
# The following is all that should need to be edited when done
# this should be last
myStarFilePath = 'C:\\StarData\\starData.csv'
################
# no need to editing anything below yet
numStars = readStarData(myStarFilePath)
processStars()
sample starData.csv file
4.0, 30.001, -21.078
5.35, 30.311, -30.002
5.14, 30.426, -44.713
4.33, 30.511, 2.764
5.23, 30.511, 2.764
2.26, 30.975, 42.33
4.84, 30.978, 42.331
4.69, 31.123, -29.297
5.03, 31.641, 22.648
2.0, 31.793, 23.463
4.82, 32.122, 37.859
4.98, 32.355, 25.94
3.0, 32.385, 34.987
4.94, 33.093, 30.303
5.27, 33.2, 21.211
5.28, 33.227, -30.724
4.37, 33.25, 8.847
4.83, 33.305, 44.232
5.28, 33.984, 33.359
4.87, 34.263, 34.224
4.01, 34.328, 33.847
5.03, 34.738, 28.643
5.3, 34.82, 47.38
3.04, 34.836, -2.978
5.28, 35.485, -0.396
5.2, 35.635, -23.816
5.19, 36.103, 50.007
4.89, 36.487, -12.291
4.25, 36.746, -47.704
5.14, 37.007, -33.811
4.28, 37.04, 8.46
5.29, 37.041, 29.669
5.25, 37.875, 2.267
4.75, 38.021, -15.245
5.15, 38.025, 36.147
5.35, 38.039, -1.035
4.9, 38.461, -28.233
5.35, 38.945, 34.688
4.86, 38.968, 5.593
5.3, 39.26, 34.264
5.3, 39.704, 21.961
4.07, 39.87, -0.329
4.84, 39.89, -11.872
4.75, 39.95, -42.892
4.11, 40.167, -39.855
5.3, 40.171, 27.061
4.91, 40.562, 40.194