Editing Talk:2853: Redshift

Jump to: navigation, search
Ambox notice.png Please sign your posts with ~~~~

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 62: Line 62:
 
</nowiki></pre></tt>
 
</nowiki></pre></tt>
  
And should you wish to make [https://i.ibb.co/LpdYXNx/time-by-redshift.png this quick reference chart for interpreting observations in the JWST era:]
+
And should you wish to make [https://i.ibb.co/kK21n1J/time-by-redshift.png this quick reference chart for interpreting observations in the JWST era:]
  
 
{{cot|Supplemental code for Look-back Time by Redshift chart}}
 
{{cot|Supplemental code for Look-back Time by Redshift chart}}
Line 69: Line 69:
 
import matplotlib.ticker as ticker
 
import matplotlib.ticker as ticker
  
rs = [z * 20 / 299 for z in range(300)]  # redshifts 0 to 20 in 300 steps
+
redshifts = [z * 20 / 299 for z in range(300)]  # 0 to 20 in 300 steps
lb = [zt(z) for z in rs] # look_back_times
+
look_back_times = [zt(z) for z in redshifts]
 
 
fo = 13.2  # furthest observation at present
 
#print(age_at_z(fo))  # 0.3285
 
plt.plot([x for x in rs if x<fo], [y for x,y in zip(rs,lb) if x<fo], color='red')
 
plt.plot([x for x in rs if x>fo], [y for x,y in zip(rs,lb) if x>fo], color='darkred')
 
plt.text(13.2, 9.5, 'Furthest observation as of 2023:\n' +
 
    'the metal-poor JADES-GS-z13-0 galaxy\nat z=13.2: 13.4 Gyr ago', ha='center')
 
  
 +
plt.plot(redshifts, look_back_times)
 
plt.title('Look-back Time by Redshift')
 
plt.title('Look-back Time by Redshift')
 
plt.xlabel('z: (observed λ - expected λ) / expected λ')
 
plt.xlabel('z: (observed λ - expected λ) / expected λ')
Line 84: Line 78:
 
plt.xticks(range(21))
 
plt.xticks(range(21))
 
plt.yticks(list(range(14)) + [age0])
 
plt.yticks(list(range(14)) + [age0])
plt.text(-0.5, 13.78, "Big Bang", va='center')
+
plt.text(-0.5, 13.78, "Big Bang", ha='left', va='center')
 
plt.gca().yaxis.set_major_formatter(ticker.FormatStrFormatter('%.1f'))
 
plt.gca().yaxis.set_major_formatter(ticker.FormatStrFormatter('%.1f'))
 
plt.grid(True, color='lightgray')
 
plt.grid(True, color='lightgray')
Line 91: Line 85:
  
 
for t in range(0, 13):
 
for t in range(0, 13):
     z = rs[min(range(len(lb)), key=lambda i: abs(lb[i]-t))]
+
     z = redshifts[min(range(len(look_back_times)),
 +
                      key=lambda i: abs(look_back_times[i]-t))]
 
     plt.text(z, t, f"  z = {z:.2f}", ha='left', va='center', fontsize='small')
 
     plt.text(z, t, f"  z = {z:.2f}", ha='left', va='center', fontsize='small')
  
Line 103: Line 98:
  
 
plt.savefig('time_by_redshift.png', bbox_inches='tight')
 
plt.savefig('time_by_redshift.png', bbox_inches='tight')
#plt.show()  # https://i.ibb.co/LpdYXNx/time-by-redshift.png
+
#plt.show()  # https://i.ibb.co/kK21n1J/time-by-redshift.png
 
</nowiki></pre></tt>
 
</nowiki></pre></tt>
 
{{cob}}
 
{{cob}}
  
Or [https://i.ibb.co/C537rxJ/age-by-redshift.png this one showing the age of the universe from redshift:]
+
Or [https://i.ibb.co/34Rk2WM/age-by-redshift.png this one showing the age of the universe from redshift:]
  
 
{{cot|Supplemental code for Age of Universe by Redshift chart}}
 
{{cot|Supplemental code for Age of Universe by Redshift chart}}
 
<tt><pre><nowiki>
 
<tt><pre><nowiki>
plt.clf()  # Reset plot
+
plt.clf()  # reset plot
 
 
rs = [z * 15 / 299 + 5 for z in range(300)]  # redshifts 5 to 20 in 300 steps
 
ages = [age_at_z(z) * 1000 for z in rs]  # Gyr to million years
 
  
plt.plot([x for x in rs if x<fo], [y for x,y in zip(rs,ages) if x<fo], color='red')
+
redshifts = [z * 15 / 299 + 5 for z in range(300)] # 5 to 20 in 300 steps
plt.plot([x for x in rs if x>fo], [y for x,y in zip(rs,ages) if x>fo], color='darkred')
+
ages = [age_at_z(z) * 1000 for z in redshifts]  # Gyr to million years
plt.text(13.2, 650, 'Furthest observation as of 2023:\n' +
 
        'the metal-poor JADES-GS-z13-0 galaxy\nat z=13.2: age 329 Myr', ha='center')
 
  
 +
plt.plot(redshifts, ages)
 
plt.title('Age of Universe by Redshift')
 
plt.title('Age of Universe by Redshift')
 
plt.xlabel('z: (observed λ - expected λ) / expected λ')
 
plt.xlabel('z: (observed λ - expected λ) / expected λ')
Line 131: Line 122:
  
 
plt.savefig('age_by_redshift.png', bbox_inches='tight')
 
plt.savefig('age_by_redshift.png', bbox_inches='tight')
#plt.show()  # https://i.ibb.co/C537rxJ/age-by-redshift.png
+
#plt.show()  # https://i.ibb.co/34Rk2WM/age-by-redshift.png
 
</nowiki></pre></tt>
 
</nowiki></pre></tt>
 
{{cob}}
 
{{cob}}

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)

Templates used on this page: